JSON! Its all JSON. Only magical ones are the 'BlueprintGeneratedClass' and 'SoundWave' items - these
+
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.
diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts
index 2f4d08e..acbf65f 100644
--- a/src/app/app-routing.module.ts
+++ b/src/app/app-routing.module.ts
@@ -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({
diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts
deleted file mode 100644
index d2e9a55..0000000
--- a/src/app/app.component.spec.ts
+++ /dev/null
@@ -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!');
- });
-});
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index bcedf7b..0ae1360 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -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);
+ }
}
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 6a0d6ec..446940f 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -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,
diff --git a/src/app/models/atlasData/blueprintGeneratedClass.model.ts b/src/app/models/atlasData/blueprintGeneratedClass.model.ts
new file mode 100644
index 0000000..7a55159
--- /dev/null
+++ b/src/app/models/atlasData/blueprintGeneratedClass.model.ts
@@ -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 ];
+ }
+}
diff --git a/src/app/models/atlasData/blueprintGeneratedClass.ts b/src/app/models/atlasData/blueprintGeneratedClass.ts
deleted file mode 100644
index b910c00..0000000
--- a/src/app/models/atlasData/blueprintGeneratedClass.ts
+++ /dev/null
@@ -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 ];
- }
-}
diff --git a/src/app/models/atlasData/questEntry.model.ts b/src/app/models/atlasData/questEntry.model.ts
new file mode 100644
index 0000000..c5fac75
--- /dev/null
+++ b/src/app/models/atlasData/questEntry.model.ts
@@ -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;
+ public CompleteGiveEngramClasses: Array;
+ public QuestPointsOfInterest: Array;
+
+ 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;
+ }
+}
\ No newline at end of file
diff --git a/src/app/models/atlasData/questEntry.ts b/src/app/models/atlasData/questEntry.ts
deleted file mode 100644
index a02863e..0000000
--- a/src/app/models/atlasData/questEntry.ts
+++ /dev/null
@@ -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;
- public CompleteGiveEngramClasses: object;
- public QuestPointsOfInterest: Array