diff --git a/modules/ui/burg-editor.js b/modules/ui/burg-editor.js index ea3a76f2..dd34b38a 100644 --- a/modules/ui/burg-editor.js +++ b/modules/ui/burg-editor.js @@ -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() { const tr = parseTransform(this.getAttribute("transform")); const dx = +tr[0] - d3.event.x, @@ -284,7 +239,9 @@ function editBurg(id) { alertMessage.innerHTML = /* html */ `Are you sure you want to remove ${ basic || capital ? "all unlocked elements in the burg group" : "the entire burg group" }? -
Please note that capital or locked burgs will not be deleted.

Burgs to be removed: ${burgsToRemove.length}`; +
Please note that capital or locked burgs will not be deleted.

Burgs to be removed: ${ + burgsToRemove.length + }`; $("#alert").dialog({ resizable: false, title: "Remove burg group", @@ -433,7 +390,8 @@ function editBurg(id) { function addCustomMfcgLink() { const id = +elSelected.attr("data-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 => { if (link) burg.link = link; else delete burg.link; @@ -581,3 +539,48 @@ function editBurg(id) { 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; +} diff --git a/modules/ui/burgs-overview.js b/modules/ui/burgs-overview.js index 4a4a14da..d0ad25c2 100644 --- a/modules/ui/burgs-overview.js +++ b/modules/ui/burgs-overview.js @@ -480,10 +480,7 @@ function overviewBurgs(settings = {stateId: null, cultureId: null}) { } 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 - if (options.showMFCGMap) data += `,City Generator Link`; - data += "\n"; - + 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 const valid = pack.burgs.filter(b => b.i && !b.removed); // all valid burgs valid.forEach(b => { @@ -504,6 +501,9 @@ function overviewBurgs(settings = {stateId: null, cultureId: null}) { data += getLatitude(b.y, 2) + ","; data += getLongitude(b.x, 2) + ","; 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 data += b.capital ? "capital," : ","; @@ -513,7 +513,9 @@ function overviewBurgs(settings = {stateId: null, cultureId: null}) { data += b.plaza ? "plaza," : ","; data += b.temple ? "temple," : ","; 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"; });