mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
export json cleanup
This commit is contained in:
parent
503eabd9d4
commit
3fe225e293
2 changed files with 173 additions and 347 deletions
12
index.html
12
index.html
|
|
@ -978,7 +978,7 @@
|
||||||
<input id="mapName" data-stored="mapName" class="long" autocorrect="off" spellcheck="false" type="text">
|
<input id="mapName" data-stored="mapName" class="long" autocorrect="off" spellcheck="false" type="text">
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<i data-tip="Regenerate map name" onclick="Names.MapName(true)" class="icon-arrows-cw"></i>
|
<i data-tip="Regenerate map name" onclick="Names.getMapName(true)" class="icon-arrows-cw"></i>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
@ -3607,12 +3607,14 @@
|
||||||
<p>GeoJSON format is used in GIS tools such as QGIS. Check out <a href="https://github.com/Azgaar/Fantasy-Map-Generator/wiki/GIS-data-export" target="_blank">wiki-page</a> for guidance.</p>
|
<p>GeoJSON format is used in GIS tools such as QGIS. Check out <a href="https://github.com/Azgaar/Fantasy-Map-Generator/wiki/GIS-data-export" target="_blank">wiki-page</a> for guidance.</p>
|
||||||
<p>Generator uses pop-up window to download files. Please ensure your browser does not block popups.</p>
|
<p>Generator uses pop-up window to download files. Please ensure your browser does not block popups.</p>
|
||||||
<p>It's also possible to export map to <i>Foundry VTT</i>, see <a href="https://github.com/Ethck/azgaar-foundry" target="_blank">the module.</a></p>
|
<p>It's also possible to export map to <i>Foundry VTT</i>, see <a href="https://github.com/Ethck/azgaar-foundry" target="_blank">the module.</a></p>
|
||||||
<div style="margin: 1em 0 .3em; font-weight: bold">Export To Json</div>
|
|
||||||
|
<div style="margin: 1em 0 .3em; font-weight: bold">Export To JSON</div>
|
||||||
<div>
|
<div>
|
||||||
<button onclick="downloadMapDataAPIJson()" data-tip="Downlads Full Data as a .json file. WARNING: This data can be huge. Use at your own risk. You can use other buttons for smaller and filtered files.">all json</button>
|
<button onclick="exportToJson('Full')" data-tip="Download full data as in JSON format. WARNING: This data can be huge. Use at your own risk">full</button>
|
||||||
<button onclick="downloadMapDataMinimalAPIJson()" data-tip="Download a json file that looks like API response. Includes global data and doesn't include cell data. For cell data you must use cells json button">minimal json</button>
|
<button onclick="exportToJson('Minimal')" data-tip="Download minimal data as in JSON format">minimal</button>
|
||||||
<button onclick="downloadCellsDataJSON()" data-tip="Download a json file that only contains cell data. And related map info.">cells json</button>
|
<button onclick="exportToJson('Cells')" data-tip="Download map metadata and cells data as in JSON format">cells</button>
|
||||||
</div>
|
</div>
|
||||||
|
<p>Export in JSON format can be used as an API replacement.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="saveMapData" style="display: none" class="dialog">
|
<div id="saveMapData" style="display: none" class="dialog">
|
||||||
|
|
|
||||||
|
|
@ -1,362 +1,186 @@
|
||||||
|
function exportToJson(type) {
|
||||||
/**
|
|
||||||
* Downloads created data of getMapDataAPIJson()
|
|
||||||
* Download all data generated
|
|
||||||
*
|
|
||||||
* @see getMapDataAPIJson
|
|
||||||
*/
|
|
||||||
function downloadMapDataAPIJson() {
|
|
||||||
if (customization) return tip("Map cannot be saved when edit mode is active, please exit the mode and retry", false, "error");
|
if (customization) return tip("Map cannot be saved when edit mode is active, please exit the mode and retry", false, "error");
|
||||||
closeDialogs("#alert");
|
closeDialogs("#alert");
|
||||||
|
|
||||||
const mapData = getMapDataAPIJson();
|
const typeMap = {
|
||||||
|
Full: getFullDataJson,
|
||||||
|
Minimal: getMinimalDataJson,
|
||||||
|
Cells: getCellsDataJson
|
||||||
|
};
|
||||||
|
|
||||||
|
const mapData = typeMap[type]();
|
||||||
const blob = new Blob([mapData], {type: "application/json"});
|
const blob = new Blob([mapData], {type: "application/json"});
|
||||||
const URL = window.URL.createObjectURL(blob);
|
const URL = window.URL.createObjectURL(blob);
|
||||||
const link = document.createElement("a");
|
const link = document.createElement("a");
|
||||||
link.download = getFileName() + "All.json";
|
link.download = getFileName(type) + ".json";
|
||||||
link.href = URL;
|
link.href = URL;
|
||||||
link.click();
|
link.click();
|
||||||
tip(`${link.download} is saved. Open "Downloads" screen (CTRL + J) to check`, true, "success", 7000);
|
tip(`${link.download} is saved. Open "Downloads" screen (CTRL + J) to check`, true, "success", 7000);
|
||||||
window.URL.revokeObjectURL(URL);
|
window.URL.revokeObjectURL(URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
function getMapInfo() {
|
||||||
* Downloads created data of getMinimalMapJSONData()
|
|
||||||
* Downloads data without cells
|
|
||||||
*
|
|
||||||
* @see getMinimalMapJSONData
|
|
||||||
*/
|
|
||||||
function downloadMapDataMinimalAPIJson() {
|
|
||||||
if (customization) return tip("Map cannot be saved when edit mode is active, please exit the mode and retry", false, "error");
|
|
||||||
closeDialogs("#alert");
|
|
||||||
|
|
||||||
const mapData = getMinimalMapJSONData();
|
|
||||||
const blob = new Blob([mapData], {type: "application/json"});
|
|
||||||
const URL = window.URL.createObjectURL(blob);
|
|
||||||
const link = document.createElement("a");
|
|
||||||
link.download = getFileName() + "MinimalDataAPI.json";
|
|
||||||
link.href = URL;
|
|
||||||
link.click();
|
|
||||||
tip(`${link.download} is saved. Open "Downloads" screen (CTRL + J) to check`, true, "success", 7000);
|
|
||||||
window.URL.revokeObjectURL(URL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Downloads created data of getCellJSONData()
|
|
||||||
*
|
|
||||||
* @see getCellJSONData
|
|
||||||
*/
|
|
||||||
function downloadCellsDataJSON() {
|
|
||||||
if (customization) return tip("Map cannot be saved when edit mode is active, please exit the mode and retry", false, "error");
|
|
||||||
closeDialogs("#alert");
|
|
||||||
const mapData = getCellJSONData();
|
|
||||||
const blob = new Blob([mapData], {type: "application/json"});
|
|
||||||
const URL = window.URL.createObjectURL(blob);
|
|
||||||
const link = document.createElement("a");
|
|
||||||
link.download = getFileName() + "CellsData.json";
|
|
||||||
link.href = URL;
|
|
||||||
link.click();
|
|
||||||
tip(`${link.download} is saved. Open "Downloads" screen (CTRL + J) to check`, true, "success", 7000);
|
|
||||||
window.URL.revokeObjectURL(URL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets current loaded map data as a JSON string.
|
|
||||||
* The file contains data looks like:
|
|
||||||
* - info
|
|
||||||
* - settings (because population and other things are related to this)
|
|
||||||
* - coords
|
|
||||||
* - notes
|
|
||||||
* - pack
|
|
||||||
*
|
|
||||||
* @returns {string} JSONString of loaded and constructed data object
|
|
||||||
*/
|
|
||||||
function getMapDataAPIJson() {
|
|
||||||
|
|
||||||
TIME && console.time("createMapDataJson");
|
|
||||||
|
|
||||||
const date = new Date();
|
|
||||||
const dateString = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
|
|
||||||
const info = {
|
const info = {
|
||||||
"version": version,
|
version,
|
||||||
"description": "Api-Like Output File Gathered From: azgaar.github.io/Fantasy-map-generator",
|
description: "Azgaar's Fantasy Map Generator output: azgaar.github.io/Fantasy-map-generator",
|
||||||
"creation-date":dateString,
|
exportedAt: new Date().toISOString(),
|
||||||
"seed" : seed,
|
mapName: mapName.value,
|
||||||
"mapId":mapId,
|
seed,
|
||||||
"mapName" : mapName.value
|
mapId
|
||||||
|
};
|
||||||
|
|
||||||
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getSettings() {
|
||||||
const settings = {
|
const settings = {
|
||||||
"distanceUnit" : distanceUnitInput.value,
|
distanceUnit: distanceUnitInput.value,
|
||||||
"distanceScale": distanceScaleInput.value,
|
distanceScale: distanceScaleInput.value,
|
||||||
"areaUnit" : areaUnit.value,
|
areaUnit: areaUnit.value,
|
||||||
"heightUnit" : heightUnit.value,
|
heightUnit: heightUnit.value,
|
||||||
"heightExponent" : heightExponentInput.value,
|
heightExponent: heightExponentInput.value,
|
||||||
"temperatureScale" : temperatureScale.value,
|
temperatureScale: temperatureScale.value,
|
||||||
"barSize" : barSizeInput.value,
|
barSize: barSizeInput.value,
|
||||||
"barLabel" : barLabel.value,
|
barLabel: barLabel.value,
|
||||||
"barBackOpacity" : barBackOpacity.value,
|
barBackOpacity: barBackOpacity.value,
|
||||||
"barBackColor" : barBackColor.value,
|
barBackColor: barBackColor.value,
|
||||||
"barPosX" : barPosX.value,
|
barPosX: barPosX.value,
|
||||||
"barPosY" : barPosY.value,
|
barPosY: barPosY.value,
|
||||||
"populationRate" : populationRate,
|
populationRate: populationRate,
|
||||||
"urbanization" : urbanization,
|
urbanization: urbanization,
|
||||||
"mapSize" : mapSizeOutput.value,
|
mapSize: mapSizeOutput.value,
|
||||||
"latitudeO" : latitudeOutput.value,
|
latitudeO: latitudeOutput.value,
|
||||||
"temperatureEquator" : temperatureEquatorOutput.value,
|
temperatureEquator: temperatureEquatorOutput.value,
|
||||||
"temperaturePole" : temperaturePoleOutput.value,
|
temperaturePole: temperaturePoleOutput.value,
|
||||||
"prec" : precOutput.value,
|
prec: precOutput.value,
|
||||||
"options" : options,
|
options: options,
|
||||||
"mapName" : mapName.value,
|
mapName: mapName.value,
|
||||||
"hideLabels" : hideLabels.checked,
|
hideLabels: hideLabels.checked,
|
||||||
"stylePreset" : stylePreset.value,
|
stylePreset: stylePreset.value,
|
||||||
"rescaleLabels" : rescaleLabels.checked,
|
rescaleLabels: rescaleLabels.checked,
|
||||||
"urbanDensity" : urbanDensity
|
urbanDensity: urbanDensity
|
||||||
};
|
};
|
||||||
const coords = mapCoordinates;
|
|
||||||
const CellConverted = {
|
return settings;
|
||||||
"i" : Array.from(pack.cells.i),
|
}
|
||||||
"v" : pack.cells.v,
|
|
||||||
"c" : pack.cells.c,
|
function getCellsData() {
|
||||||
"p" : pack.cells.p,
|
const cellConverted = {
|
||||||
"g" : Array.from(pack.cells.g),
|
i: Array.from(pack.cells.i),
|
||||||
"h" : Array.from(pack.cells.h),
|
v: pack.cells.v,
|
||||||
"area" : Array.from(pack.cells.area),
|
c: pack.cells.c,
|
||||||
"f" : Array.from(pack.cells.f),
|
p: pack.cells.p,
|
||||||
"t" : Array.from(pack.cells.t),
|
g: Array.from(pack.cells.g),
|
||||||
"haven" : Array.from(pack.cells.haven),
|
h: Array.from(pack.cells.h),
|
||||||
"harbor" : Array.from(pack.cells.harbor),
|
area: Array.from(pack.cells.area),
|
||||||
"fl" : Array.from(pack.cells.fl),
|
f: Array.from(pack.cells.f),
|
||||||
"r" : Array.from(pack.cells.r),
|
t: Array.from(pack.cells.t),
|
||||||
"conf" : Array.from(pack.cells.conf),
|
haven: Array.from(pack.cells.haven),
|
||||||
"biome" : Array.from(pack.cells.biome),
|
harbor: Array.from(pack.cells.harbor),
|
||||||
"s" : Array.from(pack.cells.s),
|
fl: Array.from(pack.cells.fl),
|
||||||
"pop" : Array.from(pack.cells.pop),
|
r: Array.from(pack.cells.r),
|
||||||
"culture" : Array.from(pack.cells.culture),
|
conf: Array.from(pack.cells.conf),
|
||||||
"burg" : Array.from(pack.cells.burg),
|
biome: Array.from(pack.cells.biome),
|
||||||
"road" : Array.from(pack.cells.road),
|
s: Array.from(pack.cells.s),
|
||||||
"crossroad" : Array.from(pack.cells.crossroad),
|
pop: Array.from(pack.cells.pop),
|
||||||
"state" : Array.from(pack.cells.state),
|
culture: Array.from(pack.cells.culture),
|
||||||
"religion" : Array.from(pack.cells.religion),
|
burg: Array.from(pack.cells.burg),
|
||||||
"province" : Array.from(pack.cells.province)
|
road: Array.from(pack.cells.road),
|
||||||
|
crossroad: Array.from(pack.cells.crossroad),
|
||||||
|
state: Array.from(pack.cells.state),
|
||||||
|
religion: Array.from(pack.cells.religion),
|
||||||
|
province: Array.from(pack.cells.province)
|
||||||
};
|
};
|
||||||
|
|
||||||
const cellObjArr = [];
|
const cellObjArr = [];
|
||||||
{
|
{
|
||||||
CellConverted.i.forEach(value => {
|
cellConverted.i.forEach(value => {
|
||||||
const cellobj = {
|
const cellobj = {
|
||||||
"i" : value,
|
i: value,
|
||||||
"v" : CellConverted.v[value],
|
v: cellConverted.v[value],
|
||||||
"c" : CellConverted.c[value],
|
c: cellConverted.c[value],
|
||||||
"p" : CellConverted.p[value],
|
p: cellConverted.p[value],
|
||||||
"g" : CellConverted.g[value],
|
g: cellConverted.g[value],
|
||||||
"h" : CellConverted.h[value],
|
h: cellConverted.h[value],
|
||||||
"area" : CellConverted.area[value],
|
area: cellConverted.area[value],
|
||||||
"f" : CellConverted.f[value],
|
f: cellConverted.f[value],
|
||||||
"t" : CellConverted.t[value],
|
t: cellConverted.t[value],
|
||||||
"haven" : CellConverted.haven[value],
|
haven: cellConverted.haven[value],
|
||||||
"harbor" : CellConverted.harbor[value],
|
harbor: cellConverted.harbor[value],
|
||||||
"fl" : CellConverted.fl[value],
|
fl: cellConverted.fl[value],
|
||||||
"r" : CellConverted.r[value],
|
r: cellConverted.r[value],
|
||||||
"conf" : CellConverted.conf[value],
|
conf: cellConverted.conf[value],
|
||||||
"biome" : CellConverted.biome[value],
|
biome: cellConverted.biome[value],
|
||||||
"s" : CellConverted.s[value],
|
s: cellConverted.s[value],
|
||||||
"pop" : CellConverted.pop[value],
|
pop: cellConverted.pop[value],
|
||||||
"culture" : CellConverted.culture[value],
|
culture: cellConverted.culture[value],
|
||||||
"burg" : CellConverted.burg[value],
|
burg: cellConverted.burg[value],
|
||||||
"road" : CellConverted.road[value],
|
road: cellConverted.road[value],
|
||||||
"crossroad" : CellConverted.crossroad[value],
|
crossroad: cellConverted.crossroad[value],
|
||||||
"state" : CellConverted.state[value],
|
state: cellConverted.state[value],
|
||||||
"religion" : CellConverted.religion[value],
|
religion: cellConverted.religion[value],
|
||||||
"province" : CellConverted.province[value]
|
province: cellConverted.province[value]
|
||||||
}
|
|
||||||
cellObjArr.push(cellobj)
|
|
||||||
})
|
|
||||||
};
|
};
|
||||||
const packs = {
|
cellObjArr.push(cellobj);
|
||||||
"cells": cellObjArr,
|
});
|
||||||
"features":pack.features,
|
|
||||||
"cultures":pack.cultures,
|
|
||||||
"burgs":pack.burgs,
|
|
||||||
"states":pack.states,
|
|
||||||
"provinces":pack.provinces,
|
|
||||||
"religions":pack.religions,
|
|
||||||
"rivers":pack.rivers,
|
|
||||||
"markers":pack.markers,
|
|
||||||
}
|
|
||||||
const biomes = biomesData;
|
|
||||||
|
|
||||||
const ExportData = {info,settings,coords,packs,biomes,notes,nameBases}
|
|
||||||
|
|
||||||
TIME && console.timeEnd("createMapDataJson");
|
|
||||||
return JSON.stringify(ExportData);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const cellsData = {
|
||||||
/**
|
cells: cellObjArr,
|
||||||
* For exporting as JSON without pack.cells
|
features: pack.features,
|
||||||
* This can become handy if user don't want a huge data.
|
cultures: pack.cultures,
|
||||||
* For assigning data to cells user must download cells data with downloadCellsData().
|
burgs: pack.burgs,
|
||||||
*
|
states: pack.states,
|
||||||
* @returns {string} JSONString data of the created object
|
provinces: pack.provinces,
|
||||||
*/
|
religions: pack.religions,
|
||||||
function getMinimalMapJSONData(){
|
rivers: pack.rivers,
|
||||||
|
markers: pack.markers
|
||||||
TIME && console.time("createMapDataMinimalJson");
|
|
||||||
|
|
||||||
const date = new Date();
|
|
||||||
const dateString = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
|
|
||||||
const info = {
|
|
||||||
"version": version,
|
|
||||||
"description": "Api-Like Output File Gathered From: azgaar.github.io/Fantasy-map-generator",
|
|
||||||
"creation-date":dateString,
|
|
||||||
"seed" : seed,
|
|
||||||
"mapId":mapId,
|
|
||||||
"mapName" : mapName.value
|
|
||||||
}
|
|
||||||
|
|
||||||
const settings = {
|
|
||||||
"distanceUnit" : distanceUnitInput.value,
|
|
||||||
"distanceScale": distanceScaleInput.value,
|
|
||||||
"areaUnit" : areaUnit.value,
|
|
||||||
"heightUnit" : heightUnit.value,
|
|
||||||
"heightExponent" : heightExponentInput.value,
|
|
||||||
"temperatureScale" : temperatureScale.value,
|
|
||||||
"barSize" : barSizeInput.value,
|
|
||||||
"barLabel" : barLabel.value,
|
|
||||||
"barBackOpacity" : barBackOpacity.value,
|
|
||||||
"barBackColor" : barBackColor.value,
|
|
||||||
"barPosX" : barPosX.value,
|
|
||||||
"barPosY" : barPosY.value,
|
|
||||||
"populationRate" : populationRate,
|
|
||||||
"urbanization" : urbanization,
|
|
||||||
"mapSize" : mapSizeOutput.value,
|
|
||||||
"latitudeO" : latitudeOutput.value,
|
|
||||||
"temperatureEquator" : temperatureEquatorOutput.value,
|
|
||||||
"temperaturePole" : temperaturePoleOutput.value,
|
|
||||||
"prec" : precOutput.value,
|
|
||||||
"options" : options,
|
|
||||||
"mapName" : mapName.value,
|
|
||||||
"hideLabels" : hideLabels.checked,
|
|
||||||
"stylePreset" : stylePreset.value,
|
|
||||||
"rescaleLabels" : rescaleLabels.checked,
|
|
||||||
"urbanDensity" : urbanDensity
|
|
||||||
};
|
};
|
||||||
const coords = mapCoordinates;
|
|
||||||
const packs = {
|
|
||||||
"features":pack.features,
|
|
||||||
"cultures":pack.cultures,
|
|
||||||
"burgs":pack.burgs,
|
|
||||||
"states":pack.states,
|
|
||||||
"provinces":pack.provinces,
|
|
||||||
"religions":pack.religions,
|
|
||||||
"rivers":pack.rivers,
|
|
||||||
"markers":pack.markers,
|
|
||||||
}
|
|
||||||
const biomes = biomesData;
|
|
||||||
|
|
||||||
const ExportData = {info,settings,coords,packs,biomes,notes,nameBases}
|
return cellsData;
|
||||||
|
|
||||||
TIME && console.timeEnd("createMapDataMinimalJson");
|
|
||||||
return JSON.stringify(ExportData);
|
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Gets data that created with info and pack.cell
|
|
||||||
* This function is created for primarly pack.cell data is too big.
|
|
||||||
* for speeding up the proccess the main data and cell data is seperated as two files.
|
|
||||||
*
|
|
||||||
* exported data look like:
|
|
||||||
* - info
|
|
||||||
* - cells
|
|
||||||
*
|
|
||||||
* @see pack
|
|
||||||
* @see getMinimalMapJSONData
|
|
||||||
* @returns {string} The JSONString of pack.cell
|
|
||||||
*/
|
|
||||||
function getCellJSONData() {
|
|
||||||
TIME && console.time("createMapDataMinimalJson");
|
|
||||||
|
|
||||||
const date = new Date();
|
function getFullDataJson() {
|
||||||
const dateString = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
|
TIME && console.time("getFullDataJson");
|
||||||
const info = {
|
|
||||||
"version": version,
|
const info = getMapInfo();
|
||||||
"description": "Api-Like Output File Gathered From: azgaar.github.io/Fantasy-map-generator",
|
const settings = getSettings();
|
||||||
"creation-date":dateString,
|
const cells = getCellsData();
|
||||||
"seed" : seed,
|
const exportData = {info, settings, coords: mapCoordinates, cells, biomes: biomesData, notes, nameBases};
|
||||||
"mapId":mapId,
|
|
||||||
"mapName" : mapName.value
|
TIME && console.timeEnd("getFullDataJson");
|
||||||
|
return JSON.stringify(exportData);
|
||||||
}
|
}
|
||||||
const CellConverted = {
|
|
||||||
"i" : Array.from(pack.cells.i),
|
// data excluding cells
|
||||||
"v" : pack.cells.v,
|
function getMinimalDataJson() {
|
||||||
"c" : pack.cells.c,
|
TIME && console.time("getMinimalDataJson");
|
||||||
"p" : pack.cells.p,
|
|
||||||
"g" : Array.from(pack.cells.g),
|
const info = getMapInfo();
|
||||||
"h" : Array.from(pack.cells.h),
|
const settings = getSettings();
|
||||||
"area" : Array.from(pack.cells.area),
|
const packData = {
|
||||||
"f" : Array.from(pack.cells.f),
|
features: pack.features,
|
||||||
"t" : Array.from(pack.cells.t),
|
cultures: pack.cultures,
|
||||||
"haven" : Array.from(pack.cells.haven),
|
burgs: pack.burgs,
|
||||||
"harbor" : Array.from(pack.cells.harbor),
|
states: pack.states,
|
||||||
"fl" : Array.from(pack.cells.fl),
|
provinces: pack.provinces,
|
||||||
"r" : Array.from(pack.cells.r),
|
religions: pack.religions,
|
||||||
"conf" : Array.from(pack.cells.conf),
|
rivers: pack.rivers,
|
||||||
"biome" : Array.from(pack.cells.biome),
|
markers: pack.markers
|
||||||
"s" : Array.from(pack.cells.s),
|
|
||||||
"pop" : Array.from(pack.cells.pop),
|
|
||||||
"culture" : Array.from(pack.cells.culture),
|
|
||||||
"burg" : Array.from(pack.cells.burg),
|
|
||||||
"road" : Array.from(pack.cells.road),
|
|
||||||
"crossroad" : Array.from(pack.cells.crossroad),
|
|
||||||
"state" : Array.from(pack.cells.state),
|
|
||||||
"religion" : Array.from(pack.cells.religion),
|
|
||||||
"province" : Array.from(pack.cells.province)
|
|
||||||
};
|
};
|
||||||
const cellObjArr = [];
|
const exportData = {info, settings, coords: mapCoordinates, pack: packData, biomes: biomesData, notes, nameBases};
|
||||||
{
|
|
||||||
CellConverted.i.forEach(value => {
|
|
||||||
const cellobj = {
|
|
||||||
"i" : value,
|
|
||||||
"v" : CellConverted.v[value],
|
|
||||||
"c" : CellConverted.c[value],
|
|
||||||
"p" : CellConverted.p[value],
|
|
||||||
"g" : CellConverted.g[value],
|
|
||||||
"h" : CellConverted.h[value],
|
|
||||||
"area" : CellConverted.area[value],
|
|
||||||
"f" : CellConverted.f[value],
|
|
||||||
"t" : CellConverted.t[value],
|
|
||||||
"haven" : CellConverted.haven[value],
|
|
||||||
"harbor" : CellConverted.harbor[value],
|
|
||||||
"fl" : CellConverted.fl[value],
|
|
||||||
"r" : CellConverted.r[value],
|
|
||||||
"conf" : CellConverted.conf[value],
|
|
||||||
"biome" : CellConverted.biome[value],
|
|
||||||
"s" : CellConverted.s[value],
|
|
||||||
"pop" : CellConverted.pop[value],
|
|
||||||
"culture" : CellConverted.culture[value],
|
|
||||||
"burg" : CellConverted.burg[value],
|
|
||||||
"road" : CellConverted.road[value],
|
|
||||||
"crossroad" : CellConverted.crossroad[value],
|
|
||||||
"state" : CellConverted.state[value],
|
|
||||||
"religion" : CellConverted.religion[value],
|
|
||||||
"province" : CellConverted.province[value]
|
|
||||||
}
|
|
||||||
cellObjArr.push(cellobj)
|
|
||||||
})
|
|
||||||
};
|
|
||||||
const cells = cellObjArr;
|
|
||||||
|
|
||||||
const ExportData = {info, cells}
|
TIME && console.timeEnd("getMinimalDataJson");
|
||||||
|
return JSON.stringify(exportData);
|
||||||
TIME && console.timeEnd("createMapDataMinimalJson");
|
|
||||||
return JSON.stringify(ExportData);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getCellsDataJson() {
|
||||||
|
TIME && console.time("getCellsDataJson");
|
||||||
|
|
||||||
|
const info = getMapInfo();
|
||||||
|
const cells = getCellsData();
|
||||||
|
const exportData = {info, cells};
|
||||||
|
|
||||||
|
TIME && console.timeEnd("getCellsDataJson");
|
||||||
|
return JSON.stringify(exportData);
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue