Reparsing UI sorted, and finished off most of server stuff
This commit is contained in:
parent
d9a36437b6
commit
2946e5f366
6 changed files with 854 additions and 448 deletions
|
|
@ -2,3 +2,8 @@
|
|||
width: 100%;
|
||||
height: 75vh;
|
||||
}
|
||||
|
||||
#deparse-editor {
|
||||
width: 100%;
|
||||
height: 50vh;
|
||||
}
|
||||
444
index.html
444
index.html
|
|
@ -31,9 +31,11 @@
|
|||
</div>
|
||||
<div class="tab-content" id="tab-content">
|
||||
<div class="tab-pane fade show active" id="tab-config">
|
||||
<span>Paste your server config in here, or use tabs to modify settings</span>
|
||||
<span>Paste your server config in here then click Editor to Config, or use tabs to modify settings and click Config to Editor!</span>
|
||||
<button class="btn btn-primary" data-bind="click: editorToConfig">Editor to Config</button>
|
||||
<button class="btn btn-primary" data-bind="click: configToEditor">Config to Editor</button>
|
||||
<div id="config-editor"></div>
|
||||
<span>Note, coordsScaling may need modifying from a string to a number - Javascript Limitation...</span>
|
||||
<span>Note, coordsScaling may need modifying from scientific notation to a number - Javascript Limitation...</span>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="tab-basic">
|
||||
<form>
|
||||
|
|
@ -90,7 +92,7 @@
|
|||
<div class="form-group row">
|
||||
<label for="coordsScaling" class="col-sm-2 col-form-label">Coords Scaling</label>
|
||||
<div class="col-sm-10">
|
||||
<input id="coordsScaling" data-bind="value: coordsScaling" type="number"
|
||||
<input id="coordsScaling" data-bind="numericValue: coordsScaling" type="number"
|
||||
step="0.000000000001" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -605,10 +607,14 @@
|
|||
<!-- ko foreach: servers -->
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<a data-bind="attr: { id: 'server-tab-' + $index() }"><h2><span data-bind="text: $data.name "></span> - (<span data-bind="text: $data.gridX "></span>,
|
||||
<hr>
|
||||
<a data-bind="attr: { id: 'server-tab-' + $index() }"><h2><span
|
||||
data-bind="text: $data.name "></span> - (<span data-bind="text: $data.gridX "></span>,
|
||||
<span data-bind="text: $data.gridY "></span>)</h2></a>
|
||||
<button class="btn btn-danger" data-bind="click: removeServer">Remove Server</button>
|
||||
<form>
|
||||
<fieldset>
|
||||
<div class="row">
|
||||
<fieldset class="col-6">
|
||||
<legend>Basic Data</legend>
|
||||
<div class="form-group row">
|
||||
<label data-bind="attr: { for: 'Server-name-' + $index() }"
|
||||
|
|
@ -700,25 +706,384 @@
|
|||
class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<!-- ko template: { name: 'textInputTemplate', data: {
|
||||
id: 'Server-AdditionalCmdLineParams-' + $index(),
|
||||
value: $data.AdditionalCmdLineParams,
|
||||
key: 'AdditionalCmdLineParams',
|
||||
label: 'CLI Params'
|
||||
} } --><!-- /ko -->
|
||||
</fieldset>
|
||||
<div class="col-6">
|
||||
<fieldset>
|
||||
<legend>Biome Options</legend>
|
||||
<!-- ko template: { name: 'deparseInputTemplate', data: {
|
||||
id: 'Server-GlobalBiomeSeamlessServerGridPreOffsetValues-' + $index(),
|
||||
value: $data.GlobalBiomeSeamlessServerGridPreOffsetValues,
|
||||
key: 'GlobalBiomeSeamlessServerGridPreOffsetValues',
|
||||
label: 'Land Values'
|
||||
} } --><!-- /ko -->
|
||||
<!-- ko template: { name: 'deparseInputTemplate', data: {
|
||||
id: 'Server-GlobalBiomeSeamlessServerGridPreOffsetValuesOceanWater-' + $index(),
|
||||
value: $data.GlobalBiomeSeamlessServerGridPreOffsetValuesOceanWater,
|
||||
key: 'GlobalBiomeSeamlessServerGridPreOffsetValuesOceanWater',
|
||||
label: 'Water Values'
|
||||
} } --><!-- /ko -->
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>Override Options</legend>
|
||||
<!-- ko template: { name: 'textInputTemplate', data: {
|
||||
id: 'Server-OceanDinoDepthEntriesOverride-' + $index(),
|
||||
value: $data.OceanDinoDepthEntriesOverride,
|
||||
key: 'OceanDinoDepthEntriesOverride',
|
||||
label: 'Dino Depth Entries'
|
||||
} } --><!-- /ko -->
|
||||
<!-- ko template: { name: 'deparseInputTemplate', data: {
|
||||
id: 'Server-OceanEpicSpawnEntriesOverrideValues-' + $index(),
|
||||
value: $data.OceanEpicSpawnEntriesOverrideValues,
|
||||
key: 'OceanEpicSpawnEntriesOverrideValues',
|
||||
label: 'Epic Spawn Values'
|
||||
} } --><!-- /ko -->
|
||||
<!-- ko template: { name: 'textInputTemplate', data: {
|
||||
id: 'Server-oceanFloatsamCratesOverride-' + $index(),
|
||||
value: $data.oceanFloatsamCratesOverride,
|
||||
key: 'oceanFloatsamCratesOverride',
|
||||
label: 'Floatsam Crates'
|
||||
} } --><!-- /ko -->
|
||||
<!-- ko template: { name: 'textInputTemplate', data: {
|
||||
id: 'Server-treasureMapLootTablesOverride-' + $index(),
|
||||
value: $data.treasureMapLootTablesOverride,
|
||||
key: 'treasureMapLootTablesOverride',
|
||||
label: 'Map Loot Tables'
|
||||
} } --><!-- /ko -->
|
||||
<!-- ko template: { name: 'textInputTemplate', data: {
|
||||
id: 'Server-oceanEpicSpawnEntriesOverrideTemplateName-' + $index(),
|
||||
value: $data.oceanEpicSpawnEntriesOverrideTemplateName,
|
||||
key: 'oceanEpicSpawnEntriesOverrideTemplateName',
|
||||
label: 'Epic Spawn Template'
|
||||
} } --><!-- /ko -->
|
||||
<!-- ko template: { name: 'textInputTemplate', data: {
|
||||
id: 'Server-NPCShipSpawnEntriesOverrideTemplateName-' + $index(),
|
||||
value: $data.NPCShipSpawnEntriesOverrideTemplateName,
|
||||
key: 'NPCShipSpawnEntriesOverrideTemplateName',
|
||||
label: 'Ship Spawn Template'
|
||||
} } --><!-- /ko -->
|
||||
<!-- ko template: { name: 'textInputTemplate', data: {
|
||||
id: 'Server-RegionOverrides-' + $index(),
|
||||
value: $data.regionOverrides,
|
||||
key: 'regionOverrides',
|
||||
label: 'Region'
|
||||
} } --><!-- /ko -->
|
||||
</fieldset>
|
||||
</div>
|
||||
<fieldset class="col-6">
|
||||
<legend>Style Options</legend>
|
||||
<div class="form-group row">
|
||||
<label data-bind="attr: { for: 'Server-GlobalBiomeSeamlessServerGridPreOffsetValues-' + $index() }"
|
||||
class="col-sm-2 col-form-label">Offset Values</label>
|
||||
<label data-bind="attr: { for: 'Server-waterColorR-' + $index() }"
|
||||
class="col-sm-2 col-form-label">Water Colour Red</label>
|
||||
<div class="col-sm-10">
|
||||
<div class="input-group">
|
||||
<input data-bind="attr: { id: 'Server-GlobalBiomeSeamlessServerGridPreOffsetValues-' + $index() }, value: $data.GlobalBiomeSeamlessServerGridPreOffsetValues"
|
||||
type="text"
|
||||
class="form-control" disabled>
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-outline-primary" data-bind="click: deparseEdit.bind($data, 'GlobalBiomeSeamlessServerGridPreOffsetValues')">Edit</button>
|
||||
<input data-bind="attr: { id: 'Server-waterColorR-' + $index() }, numericValue: $data.waterColorR"
|
||||
type="number" step="0.1"
|
||||
class="form-control">
|
||||
<small class="form-text text-muted">waterColorR</small>
|
||||
</div>
|
||||
</div>
|
||||
<small class="form-text text-muted">GlobalBiomeSeamlessServerGridPreOffsetValues</small>
|
||||
<div class="form-group row">
|
||||
<label data-bind="attr: { for: 'Server-waterColorG-' + $index() }"
|
||||
class="col-sm-2 col-form-label">Water Colour Green</label>
|
||||
<div class="col-sm-10">
|
||||
<input data-bind="attr: { id: 'Server-waterColorG-' + $index() }, numericValue: $data.waterColorG"
|
||||
type="number" step="0.1"
|
||||
class="form-control">
|
||||
<small class="form-text text-muted">waterColorG</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label data-bind="attr: { for: 'Server-waterColorB-' + $index() }"
|
||||
class="col-sm-2 col-form-label">Water Colour Blue</label>
|
||||
<div class="col-sm-10">
|
||||
<input data-bind="attr: { id: 'Server-waterColorB-' + $index() }, numericValue: $data.waterColorB"
|
||||
type="number" step="0.1"
|
||||
class="form-control">
|
||||
<small class="form-text text-muted">waterColorB</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label data-bind="attr: { for: 'Server-skyStyleIndex-' + $index() }"
|
||||
class="col-sm-2 col-form-label">Sky Style</label>
|
||||
<div class="col-sm-10">
|
||||
<input data-bind="attr: { id: 'Server-skyStyleIndex-' + $index() }, numericValue: $data.skyStyleIndex"
|
||||
type="number" step="1"
|
||||
class="form-control">
|
||||
<small class="form-text text-muted">skyStyleIndex</small>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset class="col-6">
|
||||
<legend>Misc Options</legend>
|
||||
<div class="form-group row">
|
||||
<label data-bind="attr: { for: 'Server-floorZDist-' + $index() }"
|
||||
class="col-sm-2 col-form-label">Floor Z Distance</label>
|
||||
<div class="col-sm-10">
|
||||
<input data-bind="attr: { id: 'Server-floorZDist-' + $index() }, numericValue: $data.floorZDist"
|
||||
type="number" step="1"
|
||||
class="form-control">
|
||||
<small class="form-text text-muted">floorZDist</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label data-bind="attr: { for: 'Server-utcOffset-' + $index() }"
|
||||
class="col-sm-2 col-form-label">UTC Offset</label>
|
||||
<div class="col-sm-10">
|
||||
<input data-bind="attr: { id: 'Server-utcOffset-' + $index() }, numericValue: $data.utcOffset"
|
||||
type="number" step="1"
|
||||
class="form-control">
|
||||
<small class="form-text text-muted">utcOffset</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label data-bind="attr: { for: 'Server-transitionMinZ-' + $index() }"
|
||||
class="col-sm-2 col-form-label">Min Z Transition</label>
|
||||
<div class="col-sm-10">
|
||||
<input data-bind="attr: { id: 'Server-transitionMinZ-' + $index() }, numericValue: $data.transitionMinZ"
|
||||
type="number" step="1"
|
||||
class="form-control">
|
||||
<small class="form-text text-muted">transitionMinZ</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label data-bind="attr: { for: 'Server-serverIslandPointsMultiplier-' + $index() }"
|
||||
class="col-sm-2 col-form-label">Point Multiplier</label>
|
||||
<div class="col-sm-10">
|
||||
<input data-bind="attr: { id: 'Server-serverIslandPointsMultiplier-' + $index() }, numericValue: $data.serverIslandPointsMultiplier"
|
||||
type="number" step="0.1"
|
||||
class="form-control">
|
||||
<small class="form-text text-muted">serverIslandPointsMultiplier</small>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset class="col-6">
|
||||
<legend>Date Options</legend>
|
||||
<!-- ko template: { name: 'textInputTemplate', data: {
|
||||
id: 'Server-lastModified-' + $index(),
|
||||
value: $data.lastModified,
|
||||
key: 'lastModified',
|
||||
label: 'Last Modified'
|
||||
} } --><!-- /ko -->
|
||||
<!-- ko template: { name: 'textInputTemplate', data: {
|
||||
id: 'Server-lastImageOverride-' + $index(),
|
||||
value: $data.lastImageOverride,
|
||||
key: 'lastImageOverride',
|
||||
label: 'Last Image'
|
||||
} } --><!-- /ko -->
|
||||
</fieldset>
|
||||
<fieldset class="col-6">
|
||||
<legend>Boolean Options</legend>
|
||||
<div class="form-group row">
|
||||
<label data-bind="attr: { for: 'Server-islandLocked-' + $index() }"
|
||||
class="col-sm-2 col-form-label">Island Locked</label>
|
||||
<div class="col-sm-2">
|
||||
<input data-bind="attr: { id: 'Server-islandLocked-' + $index() }, checked: $data.islandLocked"
|
||||
type="checkbox"
|
||||
class="form-control">
|
||||
</div>
|
||||
<div class="col-sm-8">
|
||||
<small class="form-text text-muted">islandLocked</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label data-bind="attr: { for: 'Server-discoLocked-' + $index() }"
|
||||
class="col-sm-2 col-form-label">Discovery Locked</label>
|
||||
<div class="col-sm-2">
|
||||
<input data-bind="attr: { id: 'Server-discoLocked-' + $index() }, checked: $data.discoLocked"
|
||||
type="checkbox"
|
||||
class="form-control">
|
||||
</div>
|
||||
<div class="col-sm-8">
|
||||
<small class="form-text text-muted">discoLocked</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label data-bind="attr: { for: 'Server-pathsLocked-' + $index() }"
|
||||
class="col-sm-2 col-form-label">Paths Locked</label>
|
||||
<div class="col-sm-2">
|
||||
<input data-bind="attr: { id: 'Server-pathsLocked-' + $index() }, checked: $data.pathsLocked"
|
||||
type="checkbox"
|
||||
class="form-control">
|
||||
</div>
|
||||
<div class="col-sm-8">
|
||||
<small class="form-text text-muted">pathsLocked</small>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset class="col-12">
|
||||
<legend>Sub Levels</legend>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Name</th>
|
||||
<th>X</th>
|
||||
<th>Y</th>
|
||||
<th>Z</th>
|
||||
<th>Pitch</th>
|
||||
<th>Yaw</th>
|
||||
<th>Roll</th>
|
||||
<th>Override</th>
|
||||
<th><button class="btn btn-primary" data-bind="click: addServerSubLevel">+</button></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody data-bind="foreach: sublevels">
|
||||
<tr>
|
||||
<td><input class="form-control" type="number" data-bind="numericValue: $data.id"></td>
|
||||
<td><input class="form-control" type="text" data-bind="value: $data.name"></td>
|
||||
<td><input class="form-control" type="number" step="0.001" data-bind="numericValue: $data.additionalTranslationX"></td>
|
||||
<td><input class="form-control" type="number" step="0.001" data-bind="numericValue: $data.additionalTranslationY"></td>
|
||||
<td><input class="form-control" type="number" step="0.001" data-bind="numericValue: $data.additionalTranslationZ"></td>
|
||||
<td><input class="form-control" type="number" step="0.001" data-bind="numericValue: $data.additionalRotationPitch"></td>
|
||||
<td><input class="form-control" type="number" step="0.001" data-bind="numericValue: $data.additionalRotationYaw"></td>
|
||||
<td><input class="form-control" type="number" step="0.001" data-bind="numericValue: $data.additionalRotationRoll"></td>
|
||||
<td><input class="form-control" type="number" data-bind="numericValue: $data.landscapeMaterialOverride"></td>
|
||||
<td><button class="btn btn-primary" data-bind="click: removeServerSubLevel">−</button></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
<fieldset class="col-12">
|
||||
<legend>Islands</legend>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Name</th>
|
||||
<th>Spawner Overrides</th>
|
||||
<th>Min Treasure Quality</th>
|
||||
<th>Max Treasure Quality</th>
|
||||
<th>NPC Volumes for Treasure</th>
|
||||
<th>Level Bounds for Treasure</th>
|
||||
<th>Prioritise Volumes for Treasures</th>
|
||||
<th>Points</th>
|
||||
<th>Bottle Supply Override</th>
|
||||
<th>Width</th>
|
||||
<th>Height</th>
|
||||
<th>X</th>
|
||||
<th>Y</th>
|
||||
<th>Rotation</th>
|
||||
<th><button class="btn btn-primary" data-bind="click: addServerIslandInstance">+</button></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody data-bind="foreach: islandInstances">
|
||||
<tr>
|
||||
<td><input class="form-control" type="number" data-bind="numericValue: $data.id"></td>
|
||||
<td><input class="form-control" type="text" data-bind="value: $data.name"></td>
|
||||
<td><i>TODO</i></td>
|
||||
<td><input class="form-control" type="number" step="0.001" data-bind="numericValue: $data.minTreasureQuality"></td>
|
||||
<td><input class="form-control" type="number" step="0.001" data-bind="numericValue: $data.maxTreasureQuality"></td>
|
||||
<td><input class="form-control" type="checkbox" data-bind="checked: $data.useNpcVolumesForTreasures"></td>
|
||||
<td><input class="form-control" type="checkbox" data-bind="checked: $data.useLevelBoundsForTreasures"></td>
|
||||
<td><input class="form-control" type="checkbox" data-bind="checked: $data.prioritizeVolumesForTreasures"></td>
|
||||
<td><input class="form-control" type="number" step="0.001" data-bind="numericValue: $data.islandPoints"></td>
|
||||
<td><input class="form-control" type="text" data-bind="value: $data.islandTreasureBottleSupplyCrateOverrides"></td>
|
||||
<td><input class="form-control" type="number" step="0.001" data-bind="numericValue: $data.islandWidth"></td>
|
||||
<td><input class="form-control" type="number" step="0.001" data-bind="numericValue: $data.islandHeight"></td>
|
||||
<td><input class="form-control" type="number" step="0.001" data-bind="numericValue: $data.worldX"></td>
|
||||
<td><input class="form-control" type="number" step="0.001" data-bind="numericValue: $data.worldY"></td>
|
||||
<td><input class="form-control" type="number" step="0.001" data-bind="numericValue: $data.rotation"></td>
|
||||
<td><button class="btn btn-primary" data-bind="click: removeServerIslandInstance">−</button></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
<fieldset class="col-12">
|
||||
<legend>Discovery Zones</legend>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Name</th>
|
||||
<th>Size X</th>
|
||||
<th>Size Y</th>
|
||||
<th>Size Z</th>
|
||||
<th>XP</th>
|
||||
<th>Manually Placed</th>
|
||||
<th>Explorer Note Index</th>
|
||||
<th>Allow Sea</th>
|
||||
<th>World X</th>
|
||||
<th>World Y</th>
|
||||
<th>Rotation</th>
|
||||
<th><button class="btn btn-primary" data-bind="click: addServerDiscoveryZone">+</button></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody data-bind="foreach: discoZones">
|
||||
<tr>
|
||||
<td><input class="form-control" type="number" data-bind="numericValue: $data.id"></td>
|
||||
<td><input class="form-control" type="text" data-bind="value: $data.name"></td>
|
||||
<td><input class="form-control" type="number" step="0.001" data-bind="numericValue: $data.sizeX"></td>
|
||||
<td><input class="form-control" type="number" step="0.001" data-bind="numericValue: $data.sizeY"></td>
|
||||
<td><input class="form-control" type="number" step="0.001" data-bind="numericValue: $data.sizeZ"></td>
|
||||
<td><input class="form-control" type="number" step="0.001" data-bind="numericValue: $data.xp"></td>
|
||||
<td><input class="form-control" type="checkbox" data-bind="checked: $data.bIsManuallyPlaced"></td>
|
||||
<td><input class="form-control" type="number" data-bind="numericValue: $data.explorerNoteIndex"></td>
|
||||
<td><input class="form-control" type="checkbox" data-bind="checked: $data.allowSea"></td>
|
||||
<td><input class="form-control" type="number" step="0.001" data-bind="numericValue: $data.worldX"></td>
|
||||
<td><input class="form-control" type="number" step="0.001" data-bind="numericValue: $data.worldY"></td>
|
||||
<td><input class="form-control" type="number" step="0.001" data-bind="numericValue: $data.rotation"></td>
|
||||
<td><button class="btn btn-primary" data-bind="click: removeServerDiscoveryZone">−</button></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
<fieldset class="col-6">
|
||||
<legend>Spawn Regions</legend>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th><button class="btn btn-primary" data-bind="click: addServerSpawnRegion">+</button></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody data-bind="foreach: spawnRegions">
|
||||
<tr>
|
||||
<td><input class="form-control" type="text" data-bind="value: $data.name"></td>
|
||||
<td><button class="btn btn-primary" data-bind="click: removeServerSpawnRegion">−</button></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
<fieldset class="col-6">
|
||||
<legend>Extra Sublevels</legend>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th><button class="btn btn-primary" data-bind="click: addExtraSubLevels">+</button></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody data-bind="foreach: extraSublevels">
|
||||
<tr>
|
||||
<td><input class="form-control" type="text" data-bind="value: $data"></td>
|
||||
<td><button class="btn btn-primary" data-bind="click: removeExtraSubLevels">−</button></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
<fieldset class="col-6">
|
||||
<legend>Total Extra Sublevels</legend>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th><button class="btn btn-primary" data-bind="click: addTotalExtraSubLevels">+</button></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody data-bind="foreach: totalExtraSublevels">
|
||||
<tr>
|
||||
<td><input class="form-control" type="text" data-bind="value: $data"></td>
|
||||
<td><button class="btn btn-primary" data-bind="click: removeTotalExtraSubLevels">−</button></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -727,6 +1092,56 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="deparse-modal" class="modal">
|
||||
<div class="modal-dialog modal-xl">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Deparsed Editor</h5>
|
||||
<button class="close" data-bind="click: cancelDeparseEdit">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>JSON! Its all JSON. Only magical ones are the 'BlueprintGeneratedClass' and 'SoundWave' items - these
|
||||
appear as an array of two items, the 'class' name and the argument for them.</p>
|
||||
<div id="deparse-editor"></div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-secondary" data-bind="click: cancelDeparseEdit">Close</button>
|
||||
<button class="btn btn-primary" data-bind="click: saveDeparseEdit">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="textInputTemplate">
|
||||
<div class="form-group row">
|
||||
<label data-bind="attr: { for: id }, text: label" class="col-sm-2 col-form-label"></label>
|
||||
<div class="col-sm-10">
|
||||
<input data-bind="attr: { id: id }, value: value"
|
||||
type="text"
|
||||
class="form-control">
|
||||
<small class="form-text text-muted" data-bind="text: key"></small>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="deparseInputTemplate">
|
||||
<div class="form-group row">
|
||||
<label data-bind="attr: { for: id }, text: label" class="col-sm-2 col-form-label"></label>
|
||||
<div class="col-sm-10">
|
||||
<div class="input-group">
|
||||
<input data-bind="attr: { id: id }, value: value" type="text" class="form-control" disabled>
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-outline-primary" data-bind="click: deparseEdit">
|
||||
Edit
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<small class="form-text text-muted" data-bind="text: key"></small>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.4.1.min.js"
|
||||
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
|
||||
crossorigin="anonymous"></script>
|
||||
|
|
@ -748,6 +1163,7 @@
|
|||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pegjs/0.9.0/peg.js"
|
||||
integrity="sha256-cwfR02g6XnRmRxZLIwyChnsn4ODrS2uSl6eODJkjrnY="
|
||||
crossorigin="anonymous"></script>
|
||||
<script src="js/atlas_reparser.js"></script>
|
||||
<script src="js/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
94
js/atlas_reparser.js
Normal file
94
js/atlas_reparser.js
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
function deparseJson(input) {
|
||||
switch (typeof input) {
|
||||
case "object":
|
||||
return deparseObject(input);
|
||||
case "number":
|
||||
return deparseNumber(input);
|
||||
case "string":
|
||||
return deparseString(input);
|
||||
case "undefined":
|
||||
return "";
|
||||
case "boolean":
|
||||
return deparseBoolean(input);
|
||||
default:
|
||||
console.log("Unknown type for input", input);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
function deparseObject(input) {
|
||||
if (Array.isArray(input)) {
|
||||
return deparseArray(input);
|
||||
}
|
||||
if (input === null) {
|
||||
return "None";
|
||||
}
|
||||
|
||||
var beginObject = '(';
|
||||
var endObject = ')';
|
||||
var nameSeparator = '=';
|
||||
var valueSeparator = ',';
|
||||
|
||||
var output = '';
|
||||
output += beginObject;
|
||||
|
||||
Object.keys(input).forEach(function (key, idx, array) {
|
||||
output += key;
|
||||
output += nameSeparator;
|
||||
output += deparseJson(input[key]);
|
||||
|
||||
if (idx !== array.length - 1) {
|
||||
// Not the last item
|
||||
output += valueSeparator
|
||||
}
|
||||
});
|
||||
output += endObject;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
function deparseArray(input) {
|
||||
// We have one funky array option, where its 2 values and one of them is a recognised class.
|
||||
if (input[0] === "BlueprintGeneratedClass") {
|
||||
return "BlueprintGeneratedClass" + "'" + input[1] + "'";
|
||||
}
|
||||
if (input[0] === "SoundWave") {
|
||||
return "SoundWave" + "'" + input[1] + "'"
|
||||
}
|
||||
|
||||
var beginObject = '(';
|
||||
var endObject = ')';
|
||||
var valueSeparator = ',';
|
||||
|
||||
var output = '';
|
||||
output += beginObject;
|
||||
|
||||
input.forEach(function (data, idx, array) {
|
||||
output += deparseJson(data);
|
||||
|
||||
if (idx !== array.length - 1) {
|
||||
output += valueSeparator;
|
||||
}
|
||||
});
|
||||
output += endObject;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
function deparseNumber(input) {
|
||||
// All numbers seem to be a string to 6 decimal places
|
||||
return Number(input).toFixed(6);
|
||||
}
|
||||
|
||||
function deparseString(input) {
|
||||
// We need to re-encode the strings properly
|
||||
return JSON.stringify(input);
|
||||
}
|
||||
|
||||
function deparseBoolean(input) {
|
||||
if ( input ) {
|
||||
return 'True';
|
||||
} else {
|
||||
return 'False';
|
||||
}
|
||||
}
|
||||
431
js/main.js
431
js/main.js
|
|
@ -23,7 +23,7 @@ editor.session.setMode("ace/mode/json");
|
|||
|
||||
var parser;
|
||||
|
||||
$.get('js/atlas.pegjs', function(data) {
|
||||
$.get('js/atlas.pegjs', function (data) {
|
||||
parser = PEG.buildParser(data);
|
||||
});
|
||||
|
||||
|
|
@ -182,21 +182,15 @@ var viewmodel = ko.mapping.fromJS({
|
|||
"gridY": 0,
|
||||
"MachineIdTag": "",
|
||||
"isHomeServer": false,
|
||||
|
||||
|
||||
"AdditionalCmdLineParams": "",
|
||||
|
||||
"floorZDist": 0,
|
||||
"utcOffset": 0,
|
||||
"transitionMinZ": 0,
|
||||
|
||||
// Biome Options
|
||||
"GlobalBiomeSeamlessServerGridPreOffsetValues": "(BiomeZoneName=\"Temperate At Land\",PreOffsetMaxDistanceFromShore=100000.000000,PreOffsetTemperatureMultiplier=1.000000,PreOffsetTemperatureMultiplierMaxDistanceFromShore=1.000000,PreOffsetTemperatureAdditionMaxDistanceFromShore=-9.000000,PreOffsetTemperatureAddition=0.000000,PreOffsetTemperatureExponent=1.000000,PreOffsetTemperatureExponentMaxDistanceFromShore=1.000000,BiomeZoneNameAltDistanceName=\"Temperate Open Water\",BiomeZoneNameAltDistanceAmount=0.000000)",
|
||||
"GlobalBiomeSeamlessServerGridPreOffsetValuesOceanWater": "(BiomeZoneName=\"Temperate Ocean Water\",PreOffsetMaxDistanceFromShore=17500.000000,PreOffsetTemperatureMultiplier=1.000000,PreOffsetTemperatureMultiplierMaxDistanceFromShore=1.000000,PreOffsetTemperatureAdditionMaxDistanceFromShore=-31.000000,PreOffsetTemperatureAddition=-5.000000,PreOffsetTemperatureExponent=1.000000,PreOffsetTemperatureExponentMaxDistanceFromShore=1.000000,BiomeZoneNameAltDistanceName=\"Temperate Deep Ocean\",BiomeZoneNameAltDistanceAmount=0.500000)",
|
||||
"GlobalBiomeSeamlessServerGridPreOffsetValues": "",
|
||||
"GlobalBiomeSeamlessServerGridPreOffsetValuesOceanWater": "",
|
||||
|
||||
// Override Options
|
||||
"OceanDinoDepthEntriesOverride": "",
|
||||
"OceanEpicSpawnEntriesOverrideValues": "(NPCSpawnEntries=((NPCsToSpawn=(BlueprintGeneratedClass'/Game/Atlas/Creatures/MeanWhale/MeanWhale_Character_BP.MeanWhale_Character_BP_C'),NPCsSpawnOffsets=((X=0.000000,Y=0.000000,Z=-700.000000)),NPCsToSpawnPercentageChance=(1.000000)),(NPCsToSpawn=(BlueprintGeneratedClass'/Game/Atlas/Creatures/MeanWhale/MeanWhale_SeaMonster_Character_BP.MeanWhale_SeaMonster_Character_BP_C'),NPCsSpawnOffsets=((X=0.000000,Y=0.000000,Z=-700.000000)),NPCsToSpawnPercentageChance=(1.000000))),NPCSpawnLimits=,MaxDesiredNumEnemiesMultiplier=4.000000)",
|
||||
"OceanEpicSpawnEntriesOverrideValues": "",
|
||||
"oceanFloatsamCratesOverride": "",
|
||||
"treasureMapLootTablesOverride": "",
|
||||
"oceanEpicSpawnEntriesOverrideTemplateName": "",
|
||||
|
|
@ -209,205 +203,30 @@ var viewmodel = ko.mapping.fromJS({
|
|||
"waterColorB": 0.0,
|
||||
"skyStyleIndex": 0,
|
||||
|
||||
|
||||
// Misc Options
|
||||
"floorZDist": 0,
|
||||
"utcOffset": 0,
|
||||
"transitionMinZ": 0,
|
||||
"serverIslandPointsMultiplier": 1.0,
|
||||
"sublevels": [
|
||||
{
|
||||
"name": "Mnt_Y_Far_05_PVE",
|
||||
"additionalTranslationX": -317251.5,
|
||||
"additionalTranslationY": -272744.5,
|
||||
"additionalTranslationZ": 0.0,
|
||||
"additionalRotationPitch": 0.0,
|
||||
"additionalRotationYaw": 0.0,
|
||||
"additionalRotationRoll": 0.0,
|
||||
"id": 28,
|
||||
"landscapeMaterialOverride": -1
|
||||
},
|
||||
{
|
||||
"name": "Mnt_Y_Farthest_05_PVE",
|
||||
"additionalTranslationX": -317251.5,
|
||||
"additionalTranslationY": -272744.5,
|
||||
"additionalTranslationZ": 0.0,
|
||||
"additionalRotationPitch": 0.0,
|
||||
"additionalRotationYaw": 0.0,
|
||||
"additionalRotationRoll": 0.0,
|
||||
"id": 28,
|
||||
"landscapeMaterialOverride": -1
|
||||
},
|
||||
{
|
||||
"name": "Mnt_Y_Marine_Cold_Near",
|
||||
"additionalTranslationX": -317251.5,
|
||||
"additionalTranslationY": -272744.5,
|
||||
"additionalTranslationZ": 0.0,
|
||||
"additionalRotationPitch": 0.0,
|
||||
"additionalRotationYaw": 0.0,
|
||||
"additionalRotationRoll": 0.0,
|
||||
"id": 28,
|
||||
"landscapeMaterialOverride": -1
|
||||
},
|
||||
{
|
||||
"name": "Mnt_Y_Near_05_PVE",
|
||||
"additionalTranslationX": -317251.5,
|
||||
"additionalTranslationY": -272744.5,
|
||||
"additionalTranslationZ": 0.0,
|
||||
"additionalRotationPitch": 0.0,
|
||||
"additionalRotationYaw": 0.0,
|
||||
"additionalRotationRoll": 0.0,
|
||||
"id": 28,
|
||||
"landscapeMaterialOverride": -1
|
||||
},
|
||||
{
|
||||
"name": "Mnt_Y_PVE",
|
||||
"additionalTranslationX": -317251.5,
|
||||
"additionalTranslationY": -272744.5,
|
||||
"additionalTranslationZ": 0.0,
|
||||
"additionalRotationPitch": 0.0,
|
||||
"additionalRotationYaw": 0.0,
|
||||
"additionalRotationRoll": 0.0,
|
||||
"id": 28,
|
||||
"landscapeMaterialOverride": -1
|
||||
},
|
||||
{
|
||||
"name": "Mnt_G_Far_03_PVE",
|
||||
"additionalTranslationX": 51799.0,
|
||||
"additionalTranslationY": 329860.0,
|
||||
"additionalTranslationZ": 0.0,
|
||||
"additionalRotationPitch": 0.0,
|
||||
"additionalRotationYaw": 0.0,
|
||||
"additionalRotationRoll": 0.0,
|
||||
"id": 34,
|
||||
"landscapeMaterialOverride": -1
|
||||
},
|
||||
{
|
||||
"name": "Mnt_G_Farthest_03_PVE",
|
||||
"additionalTranslationX": 51799.0,
|
||||
"additionalTranslationY": 329860.0,
|
||||
"additionalTranslationZ": 0.0,
|
||||
"additionalRotationPitch": 0.0,
|
||||
"additionalRotationYaw": 0.0,
|
||||
"additionalRotationRoll": 0.0,
|
||||
"id": 34,
|
||||
"landscapeMaterialOverride": -1
|
||||
},
|
||||
{
|
||||
"name": "Mnt_G_Near_03_PVE",
|
||||
"additionalTranslationX": 51799.0,
|
||||
"additionalTranslationY": 329860.0,
|
||||
"additionalTranslationZ": 0.0,
|
||||
"additionalRotationPitch": 0.0,
|
||||
"additionalRotationYaw": 0.0,
|
||||
"additionalRotationRoll": 0.0,
|
||||
"id": 34,
|
||||
"landscapeMaterialOverride": -1
|
||||
},
|
||||
{
|
||||
"name": "Mnt_G_PVE",
|
||||
"additionalTranslationX": 51799.0,
|
||||
"additionalTranslationY": 329860.0,
|
||||
"additionalTranslationZ": 0.0,
|
||||
"additionalRotationPitch": 0.0,
|
||||
"additionalRotationYaw": 0.0,
|
||||
"additionalRotationRoll": 0.0,
|
||||
"id": 34,
|
||||
"landscapeMaterialOverride": -1
|
||||
},
|
||||
{
|
||||
"name": "Mnt_G_Marine_Cold_Near",
|
||||
"additionalTranslationX": 51799.0,
|
||||
"additionalTranslationY": 329860.0,
|
||||
"additionalTranslationZ": 0.0,
|
||||
"additionalRotationPitch": 0.0,
|
||||
"additionalRotationYaw": 0.0,
|
||||
"additionalRotationRoll": 0.0,
|
||||
"id": 34,
|
||||
"landscapeMaterialOverride": -1
|
||||
}
|
||||
],
|
||||
|
||||
// Date Options
|
||||
"lastModified": "2019-04-14T21:32:04.7310108Z",
|
||||
"lastImageOverride": "0001-01-01T00:00:00",
|
||||
|
||||
//Boolean Options
|
||||
"islandLocked": true,
|
||||
"discoLocked": true,
|
||||
"pathsLocked": false,
|
||||
"extraSublevels": [],
|
||||
"totalExtraSublevels": [
|
||||
"ChildIBL_EasternTundra.uasset",
|
||||
"ChildIBL_EasternTundra_Box.uasset",
|
||||
"ChildIBL_EasternTundra_Canopy_JapanesePine.uasset",
|
||||
"ChildIBL_EasternTundra_Canopy_Paulownia.uasset",
|
||||
"ChildIBL_EasternTundra_Canopy_RedMaple.uasset",
|
||||
"MasterIBL_EasternTemperate",
|
||||
"MasterIBL_EasternTemperate_Canopy_RedMaple",
|
||||
"MasterIBL_Temperate",
|
||||
"MasterIBL_Temperate_Canopy",
|
||||
"MasterIBL_Temperate_Canopy_B"
|
||||
],
|
||||
"islandInstances": [
|
||||
{
|
||||
"name": "Mnt_Y_EU_PVE",
|
||||
"id": 28,
|
||||
"spawnerOverrides": {},
|
||||
"minTreasureQuality": -1.0,
|
||||
"maxTreasureQuality": -1.0,
|
||||
"useNpcVolumesForTreasures": false,
|
||||
"useLevelBoundsForTreasures": true,
|
||||
"prioritizeVolumesForTreasures": false,
|
||||
"islandPoints": -1,
|
||||
"islandTreasureBottleSupplyCrateOverrides": "",
|
||||
"islandWidth": 306000.0,
|
||||
"islandHeight": 306000.0,
|
||||
"worldX": 5982748.5,
|
||||
"worldY": 7427255.5,
|
||||
"rotation": 0.0
|
||||
},
|
||||
{
|
||||
"name": "Mnt_G_ET_PVE",
|
||||
"id": 34,
|
||||
"spawnerOverrides": {},
|
||||
"minTreasureQuality": -1.0,
|
||||
"maxTreasureQuality": -1.0,
|
||||
"useNpcVolumesForTreasures": false,
|
||||
"useLevelBoundsForTreasures": true,
|
||||
"prioritizeVolumesForTreasures": false,
|
||||
"islandPoints": -1,
|
||||
"islandTreasureBottleSupplyCrateOverrides": "",
|
||||
"islandWidth": 306000.0,
|
||||
"islandHeight": 306000.0,
|
||||
"worldX": 6351799.0,
|
||||
"worldY": 8029860.0,
|
||||
"rotation": 0.0
|
||||
}
|
||||
],
|
||||
"discoZones": [
|
||||
{
|
||||
"name": "Jotunheim",
|
||||
"sizeX": 283627.0,
|
||||
"sizeY": 268249.5,
|
||||
"sizeZ": 40000.0,
|
||||
"id": 109,
|
||||
"xp": 30.0,
|
||||
"bIsManuallyPlaced": false,
|
||||
"explorerNoteIndex": 0,
|
||||
"allowSea": false,
|
||||
"worldX": 5981788.5,
|
||||
"worldY": 7414445.0,
|
||||
"rotation": 0.0
|
||||
},
|
||||
{
|
||||
"name": "The Ashen Reaches",
|
||||
"sizeX": 289322.0,
|
||||
"sizeY": 297295.5,
|
||||
"sizeZ": 40000.0,
|
||||
"id": 116,
|
||||
"xp": 30.0,
|
||||
"bIsManuallyPlaced": false,
|
||||
"explorerNoteIndex": 0,
|
||||
"allowSea": false,
|
||||
"worldX": 6359387.5,
|
||||
"worldY": 8013876.0,
|
||||
"rotation": 0.0
|
||||
}
|
||||
],
|
||||
|
||||
// Long Tables
|
||||
"sublevels": [],
|
||||
"islandInstances": [],
|
||||
"discoZones": [],
|
||||
|
||||
// Mini Tables
|
||||
"spawnRegions": [],
|
||||
"extraSublevels": [],
|
||||
"totalExtraSublevels": [],
|
||||
|
||||
// ???
|
||||
"OverrideShooterGameModeDefaultGameIni": {}
|
||||
|
|
@ -422,23 +241,16 @@ var viewmodel = ko.mapping.fromJS({
|
|||
});
|
||||
ko.applyBindings(viewmodel);
|
||||
|
||||
updateEditor();
|
||||
configToEditor();
|
||||
|
||||
ko.computed(function () {
|
||||
return ko.toJSON(viewmodel);
|
||||
}).subscribe(function () {
|
||||
updateEditor();
|
||||
});
|
||||
|
||||
editor.on("change", function () {
|
||||
setTimeout(function () {
|
||||
function editorToConfig() {
|
||||
ko.mapping.fromJSON(editor.getValue(), viewmodel);
|
||||
}, 100);
|
||||
});
|
||||
}
|
||||
|
||||
function updateEditor() {
|
||||
function configToEditor() {
|
||||
var interim = ko.mapping.toJS(viewmodel);
|
||||
interim.coordsScaling = Number(interim.coordsScaling).toFixed(12);
|
||||
// coordsScaling may need special care?
|
||||
//interim.coordsScaling = Number(interim.coordsScaling).toFixed(12);
|
||||
editor.setValue(ko.toJSON(interim, null, 2));
|
||||
}
|
||||
|
||||
|
|
@ -457,16 +269,189 @@ function removeDatabase(obj) {
|
|||
}
|
||||
|
||||
function addServer() {
|
||||
console.log('boo');
|
||||
var newServer = {
|
||||
// Basic Data
|
||||
"name": ko.observable("Server Name"),
|
||||
"serverTemplateName": ko.observable("Template Name"),
|
||||
"ip": ko.observable("127.0.0.1"),
|
||||
"port": ko.observable(29145),
|
||||
"gamePort": ko.observable(3045),
|
||||
"seamlessDataPort": ko.observable(31029),
|
||||
"gridX": ko.observable(0),
|
||||
"gridY": ko.observable(0),
|
||||
"MachineIdTag": ko.observable(""),
|
||||
"isHomeServer": ko.observable(false),
|
||||
"AdditionalCmdLineParams": ko.observable(""),
|
||||
|
||||
// Biome Options
|
||||
"GlobalBiomeSeamlessServerGridPreOffsetValues": ko.observable(""),
|
||||
"GlobalBiomeSeamlessServerGridPreOffsetValuesOceanWater": ko.observable(""),
|
||||
|
||||
// Override Options
|
||||
"OceanDinoDepthEntriesOverride": ko.observable(""),
|
||||
"OceanEpicSpawnEntriesOverrideValues": ko.observable(""),
|
||||
"oceanFloatsamCratesOverride": ko.observable(""),
|
||||
"treasureMapLootTablesOverride": ko.observable(""),
|
||||
"oceanEpicSpawnEntriesOverrideTemplateName": ko.observable(""),
|
||||
"NPCShipSpawnEntriesOverrideTemplateName": ko.observable(""),
|
||||
"regionOverrides": ko.observable(""),
|
||||
|
||||
// Style Options
|
||||
"waterColorR": ko.observable(0.0),
|
||||
"waterColorG": ko.observable(0.0),
|
||||
"waterColorB": ko.observable(0.0),
|
||||
"skyStyleIndex": ko.observable(0),
|
||||
|
||||
// Misc Options
|
||||
"floorZDist": ko.observable(0),
|
||||
"utcOffset": ko.observable(0),
|
||||
"transitionMinZ": ko.observable(0),
|
||||
"serverIslandPointsMultiplier": ko.observable(1.0),
|
||||
|
||||
// Date Options
|
||||
"lastModified": ko.observable("2019-04-14T21:32:04.7310108Z"),
|
||||
"lastImageOverride": ko.observable("0001-01-01T00:00:00"),
|
||||
|
||||
// Boolean Options
|
||||
"islandLocked": ko.observable(true),
|
||||
"discoLocked": ko.observable(true),
|
||||
"pathsLocked": ko.observable(false),
|
||||
|
||||
// Tabled Options
|
||||
"sublevels": ko.observableArray([]),
|
||||
"extraSublevels": ko.observableArray([]),
|
||||
"totalExtraSublevels": ko.observableArray([]),
|
||||
"islandInstances": ko.observableArray([]),
|
||||
"discoZones": ko.observableArray([]),
|
||||
"spawnRegions": ko.observableArray([]),
|
||||
|
||||
// ???
|
||||
"OverrideShooterGameModeDefaultGameIni": ko.observable({})
|
||||
};
|
||||
viewmodel.servers.push(newServer);
|
||||
}
|
||||
|
||||
function removeServer() {
|
||||
console.log('boo2');
|
||||
function removeServer(obj) {
|
||||
viewmodel.servers.remove(obj);
|
||||
}
|
||||
|
||||
function deparseEdit(key, data, event) {
|
||||
console.log('boop');
|
||||
console.log(data);
|
||||
console.log(key);
|
||||
console.log(parser.parse(data[key]()));
|
||||
var deparseEditor = ace.edit("deparse-editor");
|
||||
deparseEditor.setTheme("ace/theme/monokai");
|
||||
deparseEditor.session.setMode("ace/mode/json");
|
||||
|
||||
var activeDeparseEdit;
|
||||
|
||||
function deparseEdit(data) {
|
||||
activeDeparseEdit = data.value;
|
||||
$('#deparse-modal').on('hide.bs.modal', function () {
|
||||
cancelDeparseEdit();
|
||||
});
|
||||
$('#deparse-modal').modal('show');
|
||||
var parsed = parser.parse(activeDeparseEdit());
|
||||
deparseEditor.setValue(ko.toJSON(parsed, null, 2));
|
||||
}
|
||||
|
||||
function cancelDeparseEdit() {
|
||||
activeDeparseEdit = undefined;
|
||||
$('#deparse-modal').off('hide.bs.modal');
|
||||
$('#deparse-modal').modal('hide');
|
||||
}
|
||||
|
||||
function saveDeparseEdit() {
|
||||
$('#deparse-modal').off('hide.bs.modal');
|
||||
$('#deparse-modal').modal('hide');
|
||||
var parsed = JSON.parse(deparseEditor.getValue());
|
||||
activeDeparseEdit(deparseJson(parsed));
|
||||
activeDeparseEdit = undefined;
|
||||
}
|
||||
|
||||
function addServerSubLevel(obj) {
|
||||
var newSubLevel = {
|
||||
"id": ko.observable(0),
|
||||
"name": ko.observable("Map_Name"),
|
||||
"additionalTranslationX": ko.observable(0),
|
||||
"additionalTranslationY": ko.observable(0),
|
||||
"additionalTranslationZ": ko.observable(0),
|
||||
"additionalRotationPitch": ko.observable(0),
|
||||
"additionalRotationYaw": ko.observable(0),
|
||||
"additionalRotationRoll": ko.observable(0),
|
||||
"landscapeMaterialOverride": ko.observable(-1)
|
||||
};
|
||||
obj.sublevels.push(newSubLevel);
|
||||
}
|
||||
|
||||
function removeServerSubLevel(obj, e) {
|
||||
ko.contextFor(e.target).$parent.sublevels.remove(obj);
|
||||
}
|
||||
|
||||
function addServerIslandInstance(obj) {
|
||||
var newIslandInstance = {
|
||||
"id": ko.observable(0),
|
||||
"name": ko.observable("Island_Name"),
|
||||
"spawnerOverrides": ko.observable({}),
|
||||
"minTreasureQuality": ko.observable(-1.0),
|
||||
"maxTreasureQuality": ko.observable(-1.0),
|
||||
"useNpcVolumesForTreasures": ko.observable(false),
|
||||
"useLevelBoundsForTreasures": ko.observable(true),
|
||||
"prioritizeVolumesForTreasures": ko.observable(false),
|
||||
"islandPoints": ko.observable(-1),
|
||||
"islandTreasureBottleSupplyCrateOverrides": ko.observable(""),
|
||||
"islandWidth": ko.observable(0),
|
||||
"islandHeight": ko.observable(0),
|
||||
"worldX": ko.observable(0),
|
||||
"worldY": ko.observable(0),
|
||||
"rotation": ko.observable(0)
|
||||
};
|
||||
obj.islandInstances.push(newIslandInstance);
|
||||
}
|
||||
|
||||
function removeServerIslandInstance(obj, e) {
|
||||
ko.contextFor(e.target).$parent.islandInstances.remove(obj);
|
||||
}
|
||||
|
||||
function addServerDiscoveryZone(obj) {
|
||||
var newDiscoveryZone = {
|
||||
"id": ko.observable(0),
|
||||
"name": ko.observable("New Discovery Zone"),
|
||||
"sizeX": ko.observable(0),
|
||||
"sizeY": ko.observable(0),
|
||||
"sizeZ": ko.observable(0),
|
||||
"xp": ko.observable(0),
|
||||
"bIsManuallyPlaced": ko.observable(false),
|
||||
"explorerNoteIndex": ko.observable(0),
|
||||
"allowSea": ko.observable(false),
|
||||
"worldX": ko.observable(0),
|
||||
"worldY": ko.observable(0),
|
||||
"rotation": ko.observable(0)
|
||||
};
|
||||
obj.discoZones.push(newDiscoveryZone);
|
||||
}
|
||||
|
||||
function removeServerDiscoveryZone(obj, e) {
|
||||
ko.contextFor(e.target).$parent.discoZones.remove(obj);
|
||||
}
|
||||
|
||||
function addServerSpawnRegion(obj) {
|
||||
var newServerSpawnRegion = {
|
||||
"name": ko.observable("")
|
||||
};
|
||||
obj.spawnRegions.push(newServerSpawnRegion);
|
||||
}
|
||||
|
||||
function removeServerSpawnRegion(obj, e) {
|
||||
ko.contextFor(e.target).$parent.spawnRegions.remove(obj);
|
||||
}
|
||||
|
||||
function addExtraSubLevels(obj) {
|
||||
var newSubLevel = '';
|
||||
obj.extraSublevels.push(newSubLevel);
|
||||
}
|
||||
|
||||
function removeExtraSubLevels(obj, e) { ko.contextFor(e.target).$parent.extraSublevels.remove(obj) }
|
||||
|
||||
function addTotalExtraSubLevels(obj) {
|
||||
var newSubLevel = '';
|
||||
obj.totalExtraSublevels.push(newSubLevel);
|
||||
}
|
||||
|
||||
function removeTotalExtraSubLevels(obj, e) { ko.contextFor(e.target).$parent.totalExtraSublevels.remove(obj) }
|
||||
|
|
@ -31,98 +31,3 @@ function fromJsonToAtlas() {
|
|||
console.log(output);
|
||||
atlasEditor.setValue(output);
|
||||
}
|
||||
|
||||
function deparseJson(input) {
|
||||
switch (typeof input) {
|
||||
case "object":
|
||||
return deparseObject(input);
|
||||
case "number":
|
||||
return deparseNumber(input);
|
||||
case "string":
|
||||
return deparseString(input);
|
||||
case "undefined":
|
||||
return "";
|
||||
case "boolean":
|
||||
return deparseBoolean(input);
|
||||
default:
|
||||
console.log("Unknown type for input", input);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
function deparseObject(input) {
|
||||
if (Array.isArray(input)) {
|
||||
return deparseArray(input);
|
||||
}
|
||||
if (input === null) {
|
||||
return "None";
|
||||
}
|
||||
|
||||
var beginObject = '(';
|
||||
var endObject = ')';
|
||||
var nameSeparator = '=';
|
||||
var valueSeparator = ',';
|
||||
|
||||
var output = '';
|
||||
output += beginObject;
|
||||
|
||||
Object.keys(input).forEach(function (key, idx, array) {
|
||||
output += key;
|
||||
output += nameSeparator;
|
||||
output += deparseJson(input[key]);
|
||||
|
||||
if (idx !== array.length - 1) {
|
||||
// Not the last item
|
||||
output += valueSeparator
|
||||
}
|
||||
});
|
||||
output += endObject;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
function deparseArray(input) {
|
||||
// We have one funky array option, where its 2 values and one of them is a recognised class.
|
||||
if (input[0] === "BlueprintGeneratedClass") {
|
||||
return "BlueprintGeneratedClass" + "'" + input[1] + "'";
|
||||
}
|
||||
if (input[0] === "SoundWave") {
|
||||
return "SoundWave" + "'" + input[1] + "'"
|
||||
}
|
||||
|
||||
var beginObject = '(';
|
||||
var endObject = ')';
|
||||
var valueSeparator = ',';
|
||||
|
||||
var output = '';
|
||||
output += beginObject;
|
||||
|
||||
input.forEach(function (data, idx, array) {
|
||||
output += deparseJson(data);
|
||||
|
||||
if (idx !== array.length - 1) {
|
||||
output += valueSeparator;
|
||||
}
|
||||
});
|
||||
output += endObject;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
function deparseNumber(input) {
|
||||
// All numbers seem to be a string to 6 decimal places
|
||||
return Number(input).toFixed(6);
|
||||
}
|
||||
|
||||
function deparseString(input) {
|
||||
// We need to re-encode the strings properly
|
||||
return JSON.stringify(input);
|
||||
}
|
||||
|
||||
function deparseBoolean(input) {
|
||||
if ( input ) {
|
||||
return 'True';
|
||||
} else {
|
||||
return 'False';
|
||||
}
|
||||
}
|
||||
|
|
@ -63,6 +63,7 @@
|
|||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pegjs/0.9.0/peg.js"
|
||||
integrity="sha256-cwfR02g6XnRmRxZLIwyChnsn4ODrS2uSl6eODJkjrnY="
|
||||
crossorigin="anonymous"></script>
|
||||
<script src="js/atlas_reparser.js"></script>
|
||||
<script src="js/parser_test.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Reference in a new issue