diff --git a/modules/burgs-and-states.js b/modules/burgs-and-states.js index 8e3879c1..f5ff63fc 100644 --- a/modules/burgs-and-states.js +++ b/modules/burgs-and-states.js @@ -198,17 +198,22 @@ window.BurgsAndStates = (() => { else b.y = rn(b.y - shift, 2); } - // define emblem - const state = pack.states[b.state]; - const stateCOA = state.coa; - let kinship = 0.25; - if (b.capital) kinship += 0.1; - else if (b.port) kinship -= 0.1; - if (b.culture !== state.culture) kinship -= 0.25; - b.type = getType(i, b.port); - const type = b.capital && P(0.2) ? "Capital" : b.type === "Generic" ? "City" : b.type; - b.coa = COA.generate(stateCOA, kinship, null, type); - b.coa.shield = COA.getShield(b.culture, b.state); + // Attach biome info + b.biome = pack.cells.biome[i]; + // Attach province info if available + b.province = pack.cells.province ? pack.cells.province[i] : undefined; + + // define emblem + const state = pack.states[b.state]; + const stateCOA = state.coa; + let kinship = 0.25; + if (b.capital) kinship += 0.1; + else if (b.port) kinship -= 0.1; + if (b.culture !== state.culture) kinship -= 0.25; + b.type = getType(i, b.port); + const type = b.capital && P(0.2) ? "Capital" : b.type === "Generic" ? "City" : b.type; + b.coa = COA.generate(stateCOA, kinship, null, type); + b.coa.shield = COA.getShield(b.culture, b.state); } // de-assign port status if it's the only one on feature diff --git a/modules/markers-generator.js b/modules/markers-generator.js index 367cdd5f..ebf544e2 100644 --- a/modules/markers-generator.js +++ b/modules/markers-generator.js @@ -1,3 +1,26 @@ +// Assign biome and province info to existing markers, burgs, and provinces after loading a map +window.assignBiomeAndProvinceInfo = function() { + // Markers + if (pack.markers && pack.cells && pack.cells.biome) { + pack.markers.forEach(marker => { + if (marker.cell !== undefined) { + marker.biome = pack.cells.biome[marker.cell]; + marker.province = pack.cells.province ? pack.cells.province[marker.cell] : undefined; + } + }); + } + // Burgs + if (pack.burgs && pack.cells && pack.cells.biome) { + pack.burgs.forEach(burg => { + if (burg.cell !== undefined) { + burg.biome = pack.cells.biome[burg.cell]; + burg.province = pack.cells.province ? pack.cells.province[burg.cell] : undefined; + } + }); + } + // Provinces (if you want to attach biome info, though provinces are usually collections of cells) + // You could aggregate biomes for each province if needed +}; "use strict"; window.Markers = (function () { @@ -154,10 +177,20 @@ window.Markers = (function () { if (marker.cell === undefined) return; const i = last(pack.markers)?.i + 1 || 0; const [x, y] = getMarkerCoordinates(marker.cell); - marker = {...base, x, y, ...marker, i}; - pack.markers.push(marker); - occupied[marker.cell] = true; - return marker; + // Attach biome and province info + const biome = pack.cells.biome[marker.cell]; + const province = pack.cells.province ? pack.cells.province[marker.cell] : undefined; + // Add Obsidian note path (customize as needed) + const obsidianNotePath = `Neblub/Orbis/Markers/${marker.type}-${marker.cell}`; + marker = {...base, x, y, ...marker, i, biome, province, obsidianNotePath}; +// Utility to open Obsidian note for a marker +window.openObsidianNote = function(notePath) { + const uri = `obsidian://open?vault=Neblub&file=${encodeURIComponent(notePath)}`; + window.open(uri, '_blank'); +}; + pack.markers.push(marker); + occupied[marker.cell] = true; + return marker; } function deleteMarker(markerId) { diff --git a/modules/ui/burgs-overview.js b/modules/ui/burgs-overview.js index 2a487b67..1e2ee2bf 100644 --- a/modules/ui/burgs-overview.js +++ b/modules/ui/burgs-overview.js @@ -481,7 +481,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}),Temperature,Temperature likeness,Capital,Port,Citadel,Walls,Plaza,Temple,Shanty Town,Emblem,City Generator Link\n`; // 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,Biome,Province Id,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 => { @@ -506,6 +506,11 @@ function overviewBurgs(settings = {stateId: null, cultureId: null}) { data += convertTemperature(temperature) + ","; data += getTemperatureLikeness(temperature) + ","; + // add biome and province id + const biomeName = b.biome !== undefined ? window.Biomes.getDefault().name[b.biome] : ""; + data += biomeName + ","; + data += b.province !== undefined ? b.province + "," : ","; + // add status data data += b.capital ? "capital," : ","; data += b.port ? "port," : ","; diff --git a/modules/ui/markers-overview.js b/modules/ui/markers-overview.js index 02999eb0..b673a9b7 100644 --- a/modules/ui/markers-overview.js +++ b/modules/ui/markers-overview.js @@ -68,7 +68,9 @@ function overviewMarkers() { function addLines() { const lines = pack.markers - .map(({i, type, icon, pinned, lock}) => { + .map(({i, type, icon, pinned, lock, biome, province}) => { + const biomeName = biome !== undefined ? window.Biomes.getDefault().name[biome] : ""; + const provinceName = province !== undefined && pack.provinces[province] ? pack.provinces[province].name : ""; return /* html */ `
${ @@ -77,6 +79,8 @@ function overviewMarkers() { : `${icon}` }
${type}
+
${biomeName}
+
${provinceName}
'"' + s.replaceAll('"', '""') + '"'; const body = pack.markers.map(marker => { - const {i, type, icon, x, y} = marker; + const {i, type, icon, x, y, biome, province} = marker; const note = notes.find(note => note.id === "marker" + i); const name = note ? quote(note.name) : "Unknown"; @@ -221,8 +225,10 @@ function overviewMarkers() { const lat = getLatitude(y, 2); const lon = getLongitude(x, 2); + const biomeName = biome !== undefined ? window.Biomes.getDefault().name[biome] : ""; + const provinceName = province !== undefined && pack.provinces[province] ? pack.provinces[province].name : ""; - return [i, type, icon, name, legend, x, y, lat, lon].join(","); + return [i, type, icon, name, legend, x, y, lat, lon, biomeName, provinceName].join(","); }); const data = headers + body.join("\n"); diff --git a/run_python_server.sh b/run_python_server.sh old mode 100644 new mode 100755