diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml index 3920ec5..cdcf8a0 100644 --- a/.idea/jsLibraryMappings.xml +++ b/.idea/jsLibraryMappings.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/Atlas Config Generator.iml b/Atlas Config Generator.iml index b3f373a..4a0b569 100644 --- a/Atlas Config Generator.iml +++ b/Atlas Config Generator.iml @@ -5,5 +5,12 @@ + + + + + + + \ No newline at end of file diff --git a/css/main.css b/css/main.css new file mode 100644 index 0000000..1109507 --- /dev/null +++ b/css/main.css @@ -0,0 +1,4 @@ +#config-editor { + width: 100%; + height: 75vh; +} \ No newline at end of file diff --git a/index.html b/index.html index 294eda5..70d684c 100644 --- a/index.html +++ b/index.html @@ -11,23 +11,502 @@ href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"> + - - -

Hello world! This is HTML5 Boilerplate.

+ +
+ +
+
+ Paste your server config in here, or use tabs to modify settings +
+ Note, coordsScaling may need modifying from a string to a number - Javascript Limitation... +
+
+
+
+ Server Arguments +
+ +
+ +
+
+
+ +
+ +
+
+
+
+ World Options +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ Grid Options +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ Image Paths +
+ +
+ +
+
+
+ +
+ +
+
+
+
+ URL Options +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ Time Options +
+ +
+ + Format: YYYY-mm-DD HH:MM:SS +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ + Format: YYYY-mm-DDTHH:MM:SS - Note different to Day Zero! +
+
+
+
+ Info Options +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ S3 Options +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ Misc Options +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+
+ Main Options +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ S3 Options +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+
+ Main Options +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ S3 Options +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+
+ Main Options +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ S3 Options +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+
- - + + + + - diff --git a/js/main.js b/js/main.js index e69de29..a5cc06c 100644 --- a/js/main.js +++ b/js/main.js @@ -0,0 +1,156 @@ +// True numeric value binding +ko.bindingHandlers.numericValue = { + init: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) { + var underlyingObservable = valueAccessor(); + var interceptor = ko.dependentObservable({ + read: underlyingObservable, + write: function (value) { + if (!isNaN(value)) { + underlyingObservable(parseFloat(value)); + } + } + }); + ko.bindingHandlers.value.init(element, function () { + return interceptor + }, allBindingsAccessor, viewModel, bindingContext); + }, + update: ko.bindingHandlers.value.update +}; + +var editor = ace.edit("config-editor"); +editor.setTheme("ace/theme/monokai"); +editor.session.setMode("ace/mode/javascript"); + +var viewmodel = ko.mapping.fromJS({ + // Server Argument Section + "BaseServerArgs": "", + "AdditionalCmdLineParams": "", + + // World Options + "WorldFriendlyName": "New Server", + "WorldAtlasId": "", + "WorldAtlasPassword": "", + "ModIDs": "", + + // Grid Options + "gridSize": 1000, + "totalGridsX": 1, + "totalGridsY": 1, + "coordsScaling": 0.000000000001, + "globalTransitionMinZ": 0.0, + + // Image Paths + "backgroundImgPath": "image.png", + "discoZonesImagePath": "image.png", + + // URL Options + "MetaWorldURL": "", + "AuthListURL": "", + "MapImageURL": "", + + // Time Options + "Day0": "2019-01-09 20:28:56", + "bUseUTCTime": false, + "columnUTCOffset": 0.0, + "lastImageOverride": "0001-01-01T00:00:00", + + // Info Options + "showServerInfo": false, + "showDiscoZoneInfo": false, + "showShipPathsInfo": false, + "showIslandNames": false, + "showLines": false, + "showBackground": false, + + // S3 Options + "LocalS3URL": "", + "LocalS3AccessKeyId": "", + "LocalS3SecretKey": "", + "LocalS3BucketName": "", + "LocalS3Region": "", + + // Unsorted... + "globalGameplaySetup": "", + "shipPathsIdGenerator": 1, + "idGenerator": 127, + "regionsIdGenerator": 0, + + // Tribe Log Tab + "TribeLogConfig": { + // Main Options + "MaxRedisEntries": 1000, + "BackupMode": "off", + "MaxFileHistory": 10, + "HttpBackupURL": "", + "HttpAPIKey": "", + + //S3 Options + "S3URL": "", + "S3AccessKeyId": "", + "S3SecretKey": "", + "S3BucketName": "", + "S3KeyPrefix": "" + }, + + // Travel Data Tab + "TravelDataConfig": { + // Main Options + "BackupMode": "off", + "MaxFileHistory": 10, + "HttpBackupURL": "", + "HttpAPIKey": "", + + //S3 Options + "S3URL": "", + "S3AccessKeyId": "", + "S3SecretKey": "", + "S3BucketName": "", + "S3KeyPrefix": "" + }, + + "SharedLogConfig": { + "FetchRateSec": 60, + "SnapshotCleanupSec": 900, + "SnapshotRateSec": 1800, + "SnapshotExpirationHours": 48, + "BackupMode": "off", + "MaxFileHistory": 10, + "HttpBackupURL": "", + "HttpAPIKey": "", + "S3URL": "", + "S3AccessKeyId": "", + "S3SecretKey": "", + "S3BucketName": "", + "S3KeyPrefix": "" + }, + + "DatabaseConnections": [], + "servers": [], + "spawnerOverrideTemplates": [], + "shipPaths": [], + "serverTemplates": [], + + // ?!?! + "OverrideShooterGameModeDefaultGameIni": {} +}); +ko.applyBindings(viewmodel); + +updateEditor(); + +ko.computed(function () { + return ko.toJSON(viewmodel); +}).subscribe(function () { + updateEditor(); +}); + +editor.on("change", function () { + setTimeout(function () { + ko.mapping.fromJSON(editor.getValue(), viewmodel); + }, 100); +}); + +function updateEditor() { + var interim = ko.mapping.toJS(viewmodel); + interim.coordsScaling = Number(interim.coordsScaling).toFixed(12); + editor.setValue(ko.toJSON(interim, null, 2)); +} \ No newline at end of file