Major parser work and start on config view side for Quests
This commit is contained in:
parent
8cf7cb66de
commit
1b4e34a4ce
35 changed files with 170501 additions and 300 deletions
|
|
@ -1,13 +0,0 @@
|
|||
# Editor configuration, see https://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
max_line_length = off
|
||||
trim_trailing_whitespace = false
|
||||
|
|
@ -1986,7 +1986,7 @@
|
|||
<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
|
||||
<p>JSON! Its all JSON. Only magical ones are the 'BlueprintGeneratedClassModel' 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>
|
||||
|
|
|
|||
|
|
@ -2,11 +2,18 @@ import { NgModule } from '@angular/core';
|
|||
import { Routes, RouterModule } from '@angular/router';
|
||||
import { RawEditorComponent } from "./pages/raw-editor/raw-editor.component";
|
||||
import { ConfigComponent } from "./pages/config/config.component";
|
||||
import { QuestsComponent } from "./pages/config/quests/quests.component";
|
||||
|
||||
|
||||
const routes: Routes = [
|
||||
{path: 'raw', component: RawEditorComponent},
|
||||
{path: 'config', component: ConfigComponent}
|
||||
{
|
||||
path: 'config', component: ConfigComponent,
|
||||
children: [
|
||||
//{path: '', component: ''}
|
||||
{path: 'quests', component: QuestsComponent},
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
|
|
|
|||
|
|
@ -1,35 +0,0 @@
|
|||
import { TestBed, async } from '@angular/core/testing';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { AppComponent } from './app.component';
|
||||
|
||||
describe('AppComponent', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
RouterTestingModule
|
||||
],
|
||||
declarations: [
|
||||
AppComponent
|
||||
],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
it('should create the app', () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.debugElement.componentInstance;
|
||||
expect(app).toBeTruthy();
|
||||
});
|
||||
|
||||
it(`should have as title 'atlas-config-generator'`, () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.debugElement.componentInstance;
|
||||
expect(app.title).toEqual('atlas-config-generator');
|
||||
});
|
||||
|
||||
it('should render title', () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
fixture.detectChanges();
|
||||
const compiled = fixture.debugElement.nativeElement;
|
||||
expect(compiled.querySelector('.content span').textContent).toContain('atlas-config-generator app is running!');
|
||||
});
|
||||
});
|
||||
|
|
@ -1,4 +1,7 @@
|
|||
import { Component } from '@angular/core';
|
||||
import { Server } from "./server";
|
||||
import { ServerGridModel } from "./models/serverGrid.model";
|
||||
import * as data from '../serverGridExample.json';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
|
|
@ -7,4 +10,9 @@ import { Component } from '@angular/core';
|
|||
})
|
||||
export class AppComponent {
|
||||
title = 'atlas-config-generator';
|
||||
|
||||
constructor(private server: Server) {
|
||||
// Temporary just load all the grid. Remove later.
|
||||
this.server.serverGrid = new ServerGridModel().deserialize((data as any).default);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,13 +10,15 @@ import { ConfigComponent } from './pages/config/config.component';
|
|||
import { FormsModule } from "@angular/forms";
|
||||
import { Server } from "./server";
|
||||
import { PegjsService } from "./services/pegjs.service";
|
||||
import { QuestsComponent } from './pages/config/quests/quests.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
RawEditorComponent,
|
||||
CodeEditorComponent,
|
||||
ConfigComponent
|
||||
ConfigComponent,
|
||||
QuestsComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
|
|
|
|||
15
src/app/models/atlasData/blueprintGeneratedClass.model.ts
Normal file
15
src/app/models/atlasData/blueprintGeneratedClass.model.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import {Deserialize} from "../util/deserialize.model";
|
||||
|
||||
export class BlueprintGeneratedClassModel implements Deserialize {
|
||||
public texture: string;
|
||||
|
||||
public deserialize(raw: any): this {
|
||||
if( raw[0] !== 'BlueprintGeneratedClass') Error('wrong type, expecting BlueprintGeneratedClassModel, got [' + raw[0] + ']!');
|
||||
this.texture = raw[1];
|
||||
return this;
|
||||
};
|
||||
|
||||
public toJSON(): object {
|
||||
return [ 'BlueprintGeneratedClass', this.texture ];
|
||||
}
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
import { ToJSON } from "../util/toJson";
|
||||
|
||||
export class BlueprintGeneratedClass implements ToJSON {
|
||||
public texture: string;
|
||||
|
||||
constructor(raw: object) {
|
||||
if( raw[0] !== 'BlueprintGeneratedClass') Error('wrong type, expecting BlueprintGeneratedClass, got [' + raw[0] + ']!');
|
||||
this.texture = raw[1];
|
||||
};
|
||||
|
||||
public toJSON(): object {
|
||||
return [ 'BlueprintGeneratedClass', this.texture ];
|
||||
}
|
||||
}
|
||||
37
src/app/models/atlasData/questEntry.model.ts
Normal file
37
src/app/models/atlasData/questEntry.model.ts
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
import { Texture2DModel } from "./texture2D.model";
|
||||
import { Deserialize } from "../util/deserialize.model";
|
||||
import { BlueprintGeneratedClassModel } from "./blueprintGeneratedClass.model";
|
||||
import { QuestPointsOfInterestModel } from "./questPointsOfInterest.model";
|
||||
|
||||
export class QuestEntryModel implements Deserialize {
|
||||
public QuestID: number;
|
||||
public CompletedIcon: Texture2DModel;
|
||||
public UncompletedIcon: Texture2DModel;
|
||||
public QuestName: string;
|
||||
public QuestDescription: string;
|
||||
public UnlockFeatNames: Array<string>;
|
||||
public CompleteGiveEngramClasses: Array<BlueprintGeneratedClassModel>;
|
||||
public QuestPointsOfInterest: Array<QuestPointsOfInterestModel>;
|
||||
|
||||
public deserialize(raw: any): this {
|
||||
Object.assign(this, raw);
|
||||
this.CompletedIcon = new Texture2DModel().deserialize(raw.CompletedIcon);
|
||||
this.UncompletedIcon = new Texture2DModel().deserialize(raw.UncompletedIcon);
|
||||
// Some Quests dont have an engram on completion
|
||||
if (this.CompleteGiveEngramClasses !== undefined)
|
||||
this.CompleteGiveEngramClasses
|
||||
= this.CompleteGiveEngramClasses.map(i => new BlueprintGeneratedClassModel().deserialize(i));
|
||||
// Some Quests have no points of interest to complete
|
||||
if (this.QuestPointsOfInterest !== undefined)
|
||||
this.QuestPointsOfInterest
|
||||
= this.QuestPointsOfInterest.map(i => new QuestPointsOfInterestModel().deserialize(i));
|
||||
return this;
|
||||
}
|
||||
|
||||
public toJSON() {
|
||||
let json = Object.assign({}, this);
|
||||
if (this.CompleteGiveEngramClasses === undefined) delete json.CompleteGiveEngramClasses;
|
||||
if (this.QuestPointsOfInterest === undefined) delete json.QuestPointsOfInterest;
|
||||
return json;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
import { Texture2D } from "./texture2D";
|
||||
|
||||
export class QuestEntry {
|
||||
public QuestID: number;
|
||||
public CompletedIcon: Texture2D;
|
||||
public UncompletedIcon: Texture2D;
|
||||
public QuestName: string;
|
||||
public QuestDescription: string;
|
||||
public UnlockFeatNames: Array<string>;
|
||||
public CompleteGiveEngramClasses: object;
|
||||
public QuestPointsOfInterest: Array<object>;
|
||||
|
||||
constructor(raw?: Partial<QuestEntry>) {
|
||||
Object.assign(this, raw);
|
||||
this.CompletedIcon = new Texture2D(raw.CompletedIcon);
|
||||
this.UncompletedIcon = new Texture2D(raw.UncompletedIcon);
|
||||
}
|
||||
|
||||
public toJSON() {
|
||||
let output = {};
|
||||
|
||||
const JsonSubModels = [
|
||||
'CompletedIcon',
|
||||
'UncompletedIcon'
|
||||
];
|
||||
|
||||
JsonSubModels.forEach(item => {
|
||||
output[item] = this[item].toJSON();
|
||||
});
|
||||
|
||||
const RawSubData = [
|
||||
'QuestID',
|
||||
'QuestName',
|
||||
'QuestDescription',
|
||||
'UnlockFeatNames',
|
||||
'CompleteGiveEngramClasses',
|
||||
'QuestPointsOfInterest'
|
||||
];
|
||||
|
||||
RawSubData.forEach(item => {
|
||||
output[item] = this[item];
|
||||
});
|
||||
|
||||
return output;
|
||||
}
|
||||
}
|
||||
20
src/app/models/atlasData/questPointsOfInterest.model.ts
Normal file
20
src/app/models/atlasData/questPointsOfInterest.model.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { Deserialize } from "../util/deserialize.model";
|
||||
import { WorldMapPositionModel } from "./worldMapPosition.model";
|
||||
import { Texture2DModel } from "./texture2D.model";
|
||||
|
||||
export class QuestPointsOfInterestModel implements Deserialize {
|
||||
public PointOfInterestID: number;
|
||||
public PointOfInterestName: string;
|
||||
public UnlockFeatNames: Array<string>;
|
||||
public WorldMapPosition: WorldMapPositionModel;
|
||||
public CompletedIcon: Texture2DModel;
|
||||
public UncompletedIcon: Texture2DModel;
|
||||
|
||||
public deserialize(input: any): this {
|
||||
Object.assign(this, input);
|
||||
this.WorldMapPosition = new WorldMapPositionModel().deserialize(input.WorldMapPosition);
|
||||
this.CompletedIcon = new Texture2DModel().deserialize(input.CompletedIcon);
|
||||
this.UncompletedIcon = new Texture2DModel().deserialize(input.UncompletedIcon);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
51
src/app/models/atlasData/server.model.ts
Normal file
51
src/app/models/atlasData/server.model.ts
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
import { Deserialize } from "../util/deserialize.model";
|
||||
import { ServerSublevelModel } from "./serverSublevel.model";
|
||||
|
||||
export class ServerModel implements Deserialize {
|
||||
gridX: number;
|
||||
gridY: number;
|
||||
MachineIdTag: string;
|
||||
ip: string;
|
||||
name: string;
|
||||
port: number;
|
||||
gamePort: number;
|
||||
seamlessDataPort: number;
|
||||
isHomeServer: boolean;
|
||||
AdditionalCmdLineParams: string;
|
||||
OverrideShooterGameModeDefaultGameIni: object;
|
||||
floorZDist: number;
|
||||
utcOffset: number;
|
||||
transitionMinZ: number;
|
||||
GlobalBiomeSeamlessServerGridPreOffsetValues: string;
|
||||
GlobalBiomeSeamlessServerGridPreOffsetValuesOceanWater: string;
|
||||
OceanDinoDepthEntriesOverride: string;
|
||||
oceanFloatsamCratesOverride: string;
|
||||
treasureMapLootTablesOverride: string;
|
||||
oceanEpicSpawnEntriesOverrideTemplateName: string;
|
||||
NPCShipSpawnEntriesOverrideTemplateName: string;
|
||||
regionOverrides: string;
|
||||
waterColorR: number;
|
||||
waterColorG: number;
|
||||
waterColorB: number;
|
||||
skyStyleIndex: number;
|
||||
serverIslandPointsMultiplier: number;
|
||||
lastModified: string;
|
||||
lastImageOverride: string;
|
||||
islandLocked: boolean;
|
||||
discoLocked: boolean;
|
||||
pathsLocked: boolean;
|
||||
extraSublevels: string[];
|
||||
totalExtraSublevels: string[];
|
||||
islandInstances;
|
||||
discoZones;
|
||||
spawnRegions;
|
||||
serverTemplateName: string;
|
||||
|
||||
sublevels: ServerSublevelModel[];
|
||||
|
||||
deserialize(input: any): this {
|
||||
Object.assign(this, input);
|
||||
this.sublevels = this.sublevels.map(i => new ServerSublevelModel().deserialize(i));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
17
src/app/models/atlasData/serverSublevel.model.ts
Normal file
17
src/app/models/atlasData/serverSublevel.model.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import { Deserialize } from "../util/deserialize.model";
|
||||
|
||||
export class ServerSublevelModel implements Deserialize {
|
||||
public name: string;
|
||||
public additionalTranslationX: number;
|
||||
public additionalTranslationY: number;
|
||||
public additionalTranslationZ: number;
|
||||
public additionalRotationPitch: number;
|
||||
public additionalRotationYaw: number;
|
||||
public additionalRotationRoll: number;
|
||||
public id: number;
|
||||
public landscapeMaterialOverride: number;
|
||||
|
||||
deserialize(input: any): this {
|
||||
return Object.assign(this, input);
|
||||
}
|
||||
}
|
||||
15
src/app/models/atlasData/texture2D.model.ts
Normal file
15
src/app/models/atlasData/texture2D.model.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import { Deserialize } from "../util/deserialize.model";
|
||||
|
||||
export class Texture2DModel implements Deserialize {
|
||||
public texture: string;
|
||||
|
||||
public deserialize(raw: any): this {
|
||||
if (raw[0] !== 'Texture2D') Error('wrong type, expecting Texture2DModel, got [' + raw[0] + ']!');
|
||||
this.texture = raw[1];
|
||||
return this;
|
||||
};
|
||||
|
||||
public toJSON(): object {
|
||||
return ['Texture2D', this.texture];
|
||||
}
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
import { ToJSON } from "../util/toJson";
|
||||
|
||||
export class Texture2D implements ToJSON {
|
||||
public texture: string;
|
||||
|
||||
constructor(raw: object) {
|
||||
if( raw[0] !== 'Texture2D') Error('wrong type, expecting Texture2D, got [' + raw[0] + ']!');
|
||||
this.texture = raw[1];
|
||||
};
|
||||
|
||||
public toJSON(): object {
|
||||
return [ 'Texture2D', this.texture ];
|
||||
}
|
||||
}
|
||||
11
src/app/models/atlasData/worldMapPosition.model.ts
Normal file
11
src/app/models/atlasData/worldMapPosition.model.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import { Deserialize } from "../util/deserialize.model";
|
||||
|
||||
export class WorldMapPositionModel implements Deserialize {
|
||||
public X: number;
|
||||
public Y: number;
|
||||
|
||||
public deserialize(input: any): this {
|
||||
Object.assign(this, input);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import {DeserializeJson} from "./util/deserializeJson.model";
|
||||
import {Deserialize} from "./util/deserialize.model";
|
||||
|
||||
export class DatabaseModel implements DeserializeJson {
|
||||
export class DatabaseConnectionModel implements Deserialize {
|
||||
public Name: string;
|
||||
public URL: string;
|
||||
public Port: number;
|
||||
|
|
@ -1,25 +1,18 @@
|
|||
import { PegjsService } from "../services/pegjs.service";
|
||||
import { ToAtlas } from "./util/toAtlas";
|
||||
import { QuestEntry } from "./atlasData/questEntry";
|
||||
import { QuestEntryModel } from "./atlasData/questEntry.model";
|
||||
import { Deserialize } from "./util/deserialize.model";
|
||||
|
||||
export class GlobalGameplaySetupModel implements ToAtlas {
|
||||
public QuestEntries: Array<QuestEntry> = [];
|
||||
export class GlobalGameplaySetupModel implements Deserialize {
|
||||
QuestEntries: QuestEntryModel[];
|
||||
|
||||
constructor(raw: any = "()") {
|
||||
const rawData = <object>PegjsService.parse(raw);
|
||||
public deserialize(raw: string): this {
|
||||
const rawData = PegjsService.parse(raw);
|
||||
Object.assign(this, rawData);
|
||||
let tempQuestEntries = [];
|
||||
this.QuestEntries.forEach(item => {
|
||||
tempQuestEntries.push(new QuestEntry(item));
|
||||
});
|
||||
this.QuestEntries = tempQuestEntries;
|
||||
this.QuestEntries = this.QuestEntries.map(i => new QuestEntryModel().deserialize(i));
|
||||
return this;
|
||||
}
|
||||
|
||||
public toAtlas(): string {
|
||||
const output = [];
|
||||
this.QuestEntries.forEach(item => {
|
||||
output.push(item.toJSON());
|
||||
});
|
||||
return PegjsService.format({QuestEntries: output});
|
||||
public toJSON(): string {
|
||||
return PegjsService.format(this, true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
import { TribeLogConfigModel } from "./tribeLogConfig.model";
|
||||
import { SharedLogConfigModel } from "./sharedLogConfig.model";
|
||||
import { TravelDataConfigModel } from "./travelDataConfig.model";
|
||||
import { ToJSON } from "./util/toJson";
|
||||
import { GlobalGameplaySetupModel } from "./GlobalGameplaySetupModel";
|
||||
import { Deserialize } from "./util/deserialize.model";
|
||||
import { DatabaseConnectionModel } from "./databaseConnection.model";
|
||||
import { ServerModel } from "./atlasData/server.model";
|
||||
|
||||
export class ServerGridModel implements ToJSON {
|
||||
export class ServerGridModel implements Deserialize {
|
||||
// Server Argument Section
|
||||
public BaseServerArgs: string = "";
|
||||
public AdditionalCmdLineParams: string = "";
|
||||
|
|
@ -62,97 +64,20 @@ export class ServerGridModel implements ToJSON {
|
|||
public SharedLogConfig: SharedLogConfigModel = new SharedLogConfigModel();
|
||||
public TravelDataConfig: TravelDataConfigModel = new TravelDataConfigModel();
|
||||
|
||||
// Large Objects of Doom
|
||||
// Quest Config
|
||||
public globalGameplaySetup: GlobalGameplaySetupModel = new GlobalGameplaySetupModel();
|
||||
|
||||
constructor(raw?: Partial<ServerGridModel>) {
|
||||
Object.assign(this, raw);
|
||||
this.SharedLogConfig = new SharedLogConfigModel(raw.SharedLogConfig);
|
||||
this.TribeLogConfig = new TribeLogConfigModel(raw.TribeLogConfig);
|
||||
this.TravelDataConfig = new TravelDataConfigModel(raw.TravelDataConfig);
|
||||
this.globalGameplaySetup = new GlobalGameplaySetupModel(raw.globalGameplaySetup);
|
||||
console.log(this);
|
||||
}
|
||||
public DatabaseConnections: DatabaseConnectionModel[];
|
||||
servers: ServerModel[];
|
||||
|
||||
public toJSON() {
|
||||
let output = {};
|
||||
|
||||
// All full models of this object for deflation
|
||||
const JsonSubModels = [
|
||||
'SharedLogConfig',
|
||||
'TribeLogConfig',
|
||||
'TravelDataConfig',
|
||||
];
|
||||
|
||||
JsonSubModels.forEach(item => {
|
||||
output[item] = this[item].toJSON();
|
||||
});
|
||||
|
||||
const AtlasSubModels = [
|
||||
'globalGameplaySetup'
|
||||
];
|
||||
|
||||
AtlasSubModels.forEach(item => {
|
||||
output[item] = this[item].toAtlas();
|
||||
});
|
||||
|
||||
const RawSubData = [
|
||||
'BaseServerArgs',
|
||||
'AdditionalCmdLineParams',
|
||||
|
||||
// World Options
|
||||
'WorldFriendlyName',
|
||||
'WorldAtlasId',
|
||||
'WorldAtlasPassword',
|
||||
'ModIDs',
|
||||
|
||||
// Grid Options
|
||||
'gridSize',
|
||||
'totalGridsX',
|
||||
'totalGridsY',
|
||||
'coordsScaling',
|
||||
'globalTransitionMinZ',
|
||||
|
||||
// Image Paths
|
||||
'backgroundImgPath',
|
||||
'discoZonesImagePath',
|
||||
|
||||
// URL Options
|
||||
'MetaWorldURL',
|
||||
'AuthListURL',
|
||||
'MapImageURL',
|
||||
|
||||
// Time Options
|
||||
'Day0',
|
||||
'bUseUTCTime',
|
||||
'columnUTCOffset',
|
||||
'lastImageOverride',
|
||||
|
||||
// Info Options
|
||||
'showServerInfo',
|
||||
'showDiscoZoneInfo',
|
||||
'showShipPathsInfo',
|
||||
'showIslandNames',
|
||||
'showLines',
|
||||
'showBackground',
|
||||
|
||||
// S3 Options
|
||||
'LocalS3URL',
|
||||
'LocalS3AccessKeyId',
|
||||
'LocalS3SecretKey',
|
||||
'LocalS3BucketName',
|
||||
'LocalS3Region',
|
||||
|
||||
// Unsorted...
|
||||
'shipPathsIdGenerator',
|
||||
'idGenerator',
|
||||
'regionsIdGenerator',
|
||||
];
|
||||
|
||||
RawSubData.forEach(item => {
|
||||
output[item] = this[item];
|
||||
});
|
||||
|
||||
return output;
|
||||
public deserialize(input: any): this {
|
||||
Object.assign(this, input);
|
||||
this.SharedLogConfig = new SharedLogConfigModel().deserialize(input.SharedLogConfig);
|
||||
this.TribeLogConfig = new TribeLogConfigModel().deserialize(input.TribeLogConfig);
|
||||
this.TravelDataConfig = new TravelDataConfigModel().deserialize(input.TravelDataConfig);
|
||||
this.globalGameplaySetup = new GlobalGameplaySetupModel().deserialize(input.globalGameplaySetup);
|
||||
this.DatabaseConnections = this.DatabaseConnections.map(i => new DatabaseConnectionModel().deserialize(i));
|
||||
this.servers = this.servers.map(i => new ServerModel().deserialize(i));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,14 @@
|
|||
import {BaseConfig} from "./abstract/baseConfig.model";
|
||||
import { ToJSON } from "./util/toJson";
|
||||
import { Deserialize } from "./util/deserialize.model";
|
||||
|
||||
export class SharedLogConfigModel extends BaseConfig implements ToJSON {
|
||||
export class SharedLogConfigModel extends BaseConfig implements Deserialize {
|
||||
public FetchRateSec: number = 60;
|
||||
public SnapshotCleanupSec: number = 900;
|
||||
public SnapshotRateSec: number = 1800;
|
||||
public SnapshotExpirationHours: number = 48;
|
||||
|
||||
constructor(raw?:Partial<SharedLogConfigModel>) {
|
||||
super();
|
||||
Object.assign(this, raw);
|
||||
}
|
||||
|
||||
public toJSON() {
|
||||
public deserialize(input: any): this {
|
||||
Object.assign(this, input);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,10 @@
|
|||
import {BaseConfig} from "./abstract/baseConfig.model";
|
||||
import { ToJSON } from "./util/toJson";
|
||||
import { Deserialize } from "./util/deserialize.model";
|
||||
|
||||
export class TravelDataConfigModel extends BaseConfig implements ToJSON {
|
||||
export class TravelDataConfigModel extends BaseConfig implements Deserialize {
|
||||
|
||||
constructor(raw?:Partial<TravelDataConfigModel>) {
|
||||
super();
|
||||
Object.assign(this, raw);
|
||||
}
|
||||
|
||||
public toJSON() {
|
||||
public deserialize(input: any): this {
|
||||
Object.assign(this, input);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,13 @@
|
|||
import {BaseConfig} from "./abstract/baseConfig.model";
|
||||
import { ToJSON } from "./util/toJson";
|
||||
import {Deserialize} from "./util/deserialize.model";
|
||||
import {Serialize} from "./util/serialize.model";
|
||||
import {PegjsService} from "../services/pegjs.service";
|
||||
|
||||
export class TribeLogConfigModel extends BaseConfig implements ToJSON {
|
||||
export class TribeLogConfigModel extends BaseConfig implements Deserialize {
|
||||
public MaxRedisEntries: number = 1000;
|
||||
|
||||
constructor(raw?:Partial<TribeLogConfigModel>) {
|
||||
super();
|
||||
public deserialize(raw: any): this {
|
||||
Object.assign(this, raw);
|
||||
}
|
||||
|
||||
public toJSON() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
export interface DeserializeJson {
|
||||
export interface Deserialize {
|
||||
deserialize(input: any): this;
|
||||
}
|
||||
3
src/app/models/util/serialize.model.ts
Normal file
3
src/app/models/util/serialize.model.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export interface Serialize {
|
||||
serialize(): any;
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
export interface ToAtlas {
|
||||
toString(): string;
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
export interface ToJSON {
|
||||
toJSON(): object;
|
||||
}
|
||||
|
|
@ -1,2 +1,6 @@
|
|||
<p>config works!</p>
|
||||
<input [(ngModel)]="server.serverGrid.WorldFriendlyName">
|
||||
<div class="row">
|
||||
<div class="col-2 mt-3">
|
||||
<button class="btn btn-primary btn-block" [routerLink]="['quests']">Quest Settings</button>
|
||||
</div>
|
||||
<div class="col-10"><router-outlet></router-outlet></div>
|
||||
</div>
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ConfigComponent } from './config.component';
|
||||
|
||||
describe('ConfigComponent', () => {
|
||||
let component: ConfigComponent;
|
||||
let fixture: ComponentFixture<ConfigComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ConfigComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ConfigComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
32
src/app/pages/config/quests/quests.component.html
Normal file
32
src/app/pages/config/quests/quests.component.html
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<div class="row">
|
||||
<div class="col-12 mt-3" *ngFor="let quest of quests">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="card-title">{{ quest.QuestID }} - {{ quest.QuestName }}</h4>
|
||||
<p class="card-text">{{ quest.QuestDescription }}</p>
|
||||
</div>
|
||||
<div class="card-header" *ngIf="quest.UnlockFeatNames">Feat Unlocks</div>
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item" *ngFor="let feat of quest.UnlockFeatNames">{{ feat }}</li>
|
||||
</ul>
|
||||
<div class="card-header" *ngIf="quest.CompleteGiveEngramClasses">Engram Unlocks</div>
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item" *ngFor="let engram of quest.CompleteGiveEngramClasses">
|
||||
Blueprint: {{ engram.texture }}
|
||||
</li>
|
||||
</ul>
|
||||
<div class="card-header" *ngIf="quest.QuestPointsOfInterest">Points of Interest</div>
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item" *ngFor="let poi of quest.QuestPointsOfInterest">
|
||||
<strong>
|
||||
{{ poi.PointOfInterestID }} - {{ poi.PointOfInterestName }}
|
||||
(X: {{ poi.WorldMapPosition.X }} - Y: {{ poi.WorldMapPosition.Y }})
|
||||
</strong>
|
||||
<ul *ngIf="poi.UnlockFeatNames">
|
||||
<li *ngFor="let feat of poi.UnlockFeatNames">{{ feat }}</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
0
src/app/pages/config/quests/quests.component.scss
Normal file
0
src/app/pages/config/quests/quests.component.scss
Normal file
19
src/app/pages/config/quests/quests.component.ts
Normal file
19
src/app/pages/config/quests/quests.component.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import { Server } from "../../../server";
|
||||
import { QuestEntryModel } from "../../../models/atlasData/questEntry.model";
|
||||
|
||||
@Component({
|
||||
selector: 'app-quests',
|
||||
templateUrl: './quests.component.html',
|
||||
styleUrls: ['./quests.component.scss']
|
||||
})
|
||||
export class QuestsComponent implements OnInit {
|
||||
quests: QuestEntryModel[];
|
||||
|
||||
constructor(private server: Server) {
|
||||
this.quests = server.serverGrid.globalGameplaySetup.QuestEntries;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
}
|
||||
|
|
@ -5,21 +5,20 @@ import { ServerGridModel } from "./models/serverGrid.model";
|
|||
export class Server {
|
||||
private rawData: string = "";
|
||||
private jsonData: object = {};
|
||||
public serverGrid: ServerGridModel = new ServerGridModel({});
|
||||
public serverGrid: ServerGridModel = new ServerGridModel();
|
||||
|
||||
public load(raw) {
|
||||
this.rawData = raw;
|
||||
try {
|
||||
this.jsonData = JSON.parse(this.rawData);
|
||||
this.serverGrid = new ServerGridModel(this.jsonData);
|
||||
this.serverGrid = new ServerGridModel().deserialize(this.jsonData);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
public save() {
|
||||
this.jsonData = this.serverGrid.toJSON();
|
||||
this.rawData = JSON.stringify(this.jsonData);
|
||||
this.rawData = JSON.stringify(this.serverGrid, null, 2);
|
||||
return this.rawData;
|
||||
}
|
||||
}
|
||||
|
|
@ -25,11 +25,21 @@ export class PegjsService {
|
|||
return output;
|
||||
}
|
||||
|
||||
public static format(input: object): string {
|
||||
return PegjsService.deparseJson(input)
|
||||
public static format(input: object, skipCurrentObject?: boolean): string {
|
||||
return PegjsService.deparseJson(input, undefined, skipCurrentObject)
|
||||
}
|
||||
|
||||
private static deparseJson(input, key?) {
|
||||
private static deparseJson(input, key?, skip?: boolean) {
|
||||
// Call possible toJSON on object
|
||||
if(!skip && typeof input === 'object' && typeof input.toJSON === 'function') {
|
||||
input = input.toJSON();
|
||||
}
|
||||
// if(input !== undefined && input.hasOwnProperty('toJSON') && typeof input.toJSON === 'function') {
|
||||
// console.log("calling toJSON!");
|
||||
// console.log(input);
|
||||
// input = input.toJSON();
|
||||
// console.log(input);
|
||||
// }
|
||||
switch (typeof input) {
|
||||
case "object":
|
||||
return PegjsService.deparseObject(input);
|
||||
|
|
|
|||
170195
src/serverGridExample.json
Normal file
170195
src/serverGridExample.json
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -7,6 +7,7 @@
|
|||
"declaration": false,
|
||||
"downlevelIteration": true,
|
||||
"experimentalDecorators": true,
|
||||
"resolveJsonModule": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"importHelpers": true,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue