|
@@ -14,135 +14,141 @@ export class CharacterCreatorComponent {
|
|
|
|
|
|
public characterName: string = '';
|
|
|
|
|
|
- public createCharacter(): void {
|
|
|
+ public async createCharacter(): Promise<void> {
|
|
|
this.dataService.addData('characters', { name: this.characterName });
|
|
|
|
|
|
- this.createNewCharacterInDatabase();
|
|
|
+ await this.createNewCharacterInDatabase();
|
|
|
+
|
|
|
this.dataService.selectCharacter(this.characterName);
|
|
|
}
|
|
|
|
|
|
- public createNewCharacterInDatabase(): void {
|
|
|
+ public async createNewCharacterInDatabase(): Promise<void> {
|
|
|
|
|
|
+ return Promise.all([
|
|
|
+
|
|
|
+ this.dataService.addData(
|
|
|
+ this.characterName,
|
|
|
+ {
|
|
|
+ name: this.characterName,
|
|
|
+ class: '',
|
|
|
+ race: '',
|
|
|
+ level: '',
|
|
|
+ subclass: '',
|
|
|
+ proficiency: '',
|
|
|
+ background: '',
|
|
|
+ experience: '',
|
|
|
+ inspiration: '',
|
|
|
+ proficiencyBonus: '',
|
|
|
+ },
|
|
|
+ 'characterData'
|
|
|
+ ),
|
|
|
|
|
|
-
|
|
|
- this.dataService.addData(
|
|
|
- this.characterName,
|
|
|
- {
|
|
|
- name: this.characterName,
|
|
|
- class: '',
|
|
|
- race: '',
|
|
|
- level: '',
|
|
|
- subclass: '',
|
|
|
- proficiency: '',
|
|
|
- background: '',
|
|
|
- experience: '',
|
|
|
- inspiration: '',
|
|
|
- proficiencyBonus: '',
|
|
|
- },
|
|
|
- 'characterData'
|
|
|
- );
|
|
|
+
|
|
|
+ this.dataService.addData(
|
|
|
+ this.characterName,
|
|
|
+ {
|
|
|
+ strength: ['', false],
|
|
|
+ dexterity: ['', false],
|
|
|
+ constitution: ['', false],
|
|
|
+ intelligence: ['', false],
|
|
|
+ wisdom: ['', false],
|
|
|
+ charisma: ['', false],
|
|
|
+ },
|
|
|
+ 'attribute'
|
|
|
+ ),
|
|
|
|
|
|
-
|
|
|
- this.dataService.addData(
|
|
|
- this.characterName,
|
|
|
- {
|
|
|
- strength: ['', false],
|
|
|
- dexterity: ['', false],
|
|
|
- constitution: ['', false],
|
|
|
- intelligence: ['', false],
|
|
|
- wisdom: ['', false],
|
|
|
- charisma: ['', false],
|
|
|
- },
|
|
|
- 'attribute'
|
|
|
- );
|
|
|
+
|
|
|
+ this.dataService.addData(
|
|
|
+ this.characterName,
|
|
|
+ {
|
|
|
+ acrobatics: ['', false],
|
|
|
+ animalHandling: ['', false],
|
|
|
+ arcana: ['', false],
|
|
|
+ athletics: ['', false],
|
|
|
+ deception: ['', false],
|
|
|
+ history: ['', false],
|
|
|
+ insight: ['', false],
|
|
|
+ intimidation: ['', false],
|
|
|
+ investigation: ['', false],
|
|
|
+ medicine: ['', false],
|
|
|
+ nature: ['', false],
|
|
|
+ perception: ['', false],
|
|
|
+ performance: ['', false],
|
|
|
+ persuasion: ['', false],
|
|
|
+ religion: ['', false],
|
|
|
+ sleightOfHand: ['', false],
|
|
|
+ stealth: ['', false],
|
|
|
+ survival: ['', false],
|
|
|
+ },
|
|
|
+ 'skill'
|
|
|
+ ),
|
|
|
+
|
|
|
+ this.dataService.addData(
|
|
|
+ this.characterName,
|
|
|
+ {
|
|
|
+ armorClass: '',
|
|
|
+ initiative: '',
|
|
|
+ speed: '',
|
|
|
+ hitPointMaximum: '',
|
|
|
+ currentHitPoints: '',
|
|
|
+ temporaryHitPoints: '',
|
|
|
+ hitDice: '',
|
|
|
+ deathSaveSuccesses: '',
|
|
|
+ deathSaveFailures: '',
|
|
|
+ },
|
|
|
+ 'combatStats'
|
|
|
+ ),
|
|
|
+
|
|
|
+ this.dataService.addData(
|
|
|
+ this.characterName,
|
|
|
+ {
|
|
|
+ age: '',
|
|
|
+ height: '',
|
|
|
+ weight: '',
|
|
|
+ eyes: '',
|
|
|
+ skin: '',
|
|
|
+ hair: '',
|
|
|
+ },
|
|
|
+ 'appearance'
|
|
|
+ ),
|
|
|
+
|
|
|
+ this.dataService.addData(
|
|
|
+ this.characterName,
|
|
|
+ {
|
|
|
+ personalityTraits: '',
|
|
|
+ ideals: '',
|
|
|
+ bonds: '',
|
|
|
+ flaws: '',
|
|
|
+ },
|
|
|
+ 'personality'
|
|
|
+ ),
|
|
|
+
|
|
|
+ this.dataService.addData(
|
|
|
+ this.characterName,
|
|
|
+ {
|
|
|
+ name: '',
|
|
|
+ attackBonus: '',
|
|
|
+ damage: '',
|
|
|
+ type: '',
|
|
|
+ range: '',
|
|
|
+ description: '',
|
|
|
+ },
|
|
|
+ 'weapons'
|
|
|
+ ),
|
|
|
|
|
|
-
|
|
|
- this.dataService.addData(
|
|
|
- this.characterName,
|
|
|
- {
|
|
|
- acrobatics: ['', false],
|
|
|
- animalHandling: ['', false],
|
|
|
- arcana: ['', false],
|
|
|
- athletics: ['', false],
|
|
|
- deception: ['', false],
|
|
|
- history: ['', false],
|
|
|
- insight: ['', false],
|
|
|
- intimidation: ['', false],
|
|
|
- investigation: ['', false],
|
|
|
- medicine: ['', false],
|
|
|
- nature: ['', false],
|
|
|
- perception: ['', false],
|
|
|
- performance: ['', false],
|
|
|
- persuasion: ['', false],
|
|
|
- religion: ['', false],
|
|
|
- sleightOfHand: ['', false],
|
|
|
- stealth: ['', false],
|
|
|
- survival: ['', false],
|
|
|
- },
|
|
|
- 'skill'
|
|
|
- );
|
|
|
- this.dataService.addData(
|
|
|
- this.characterName,
|
|
|
- {
|
|
|
- armorClass: '',
|
|
|
- initiative: '',
|
|
|
- speed: '',
|
|
|
- hitPointMaximum: '',
|
|
|
- currentHitPoints: '',
|
|
|
- temporaryHitPoints: '',
|
|
|
- hitDice: '',
|
|
|
- deathSaveSuccesses: '',
|
|
|
- deathSaveFailures: '',
|
|
|
- },
|
|
|
- 'combatStats'
|
|
|
- );
|
|
|
- this.dataService.addData(
|
|
|
- this.characterName,
|
|
|
- {
|
|
|
- age: '',
|
|
|
- height: '',
|
|
|
- weight: '',
|
|
|
- eyes: '',
|
|
|
- skin: '',
|
|
|
- hair: '',
|
|
|
- },
|
|
|
- 'appearance'
|
|
|
- );
|
|
|
- this.dataService.addData(
|
|
|
- this.characterName,
|
|
|
- {
|
|
|
- personalityTraits: '',
|
|
|
- ideals: '',
|
|
|
- bonds: '',
|
|
|
- flaws: '',
|
|
|
- },
|
|
|
- 'personality'
|
|
|
- );
|
|
|
- this.dataService.addData(
|
|
|
- this.characterName,
|
|
|
- {
|
|
|
- name: '',
|
|
|
- attackBonus: '',
|
|
|
- damage: '',
|
|
|
- type: '',
|
|
|
- range: '',
|
|
|
- description: '',
|
|
|
- },
|
|
|
- 'weapons'
|
|
|
- );
|
|
|
+
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+ ]).then(() => {});
|
|
|
}
|
|
|
}
|