123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442 |
- import { Component } from '@angular/core';
- import { DataService } from 'src/services/data/data.service';
- import { Router } from '@angular/router';
- interface characterData {
- view: string;
- value: string;
- }
- @Component({
- selector: 'app-character-creator',
- templateUrl: './character-creator.component.html',
- styleUrls: ['./character-creator.component.scss'],
- })
- export class CharacterCreatorComponent {
- selectedValue: string = '';
- // Translators
- // TODO: Implement the species
- public species: characterData[] = [
- { view: 'Mensch', value: 'Human' },
- { view: 'Zwerg', value: 'Dwarf' },
- { view: 'Elf', value: 'Elf' },
- { view: 'Eladrin', value: 'Eladrin' },
- { view: 'Halbelf', value: 'HalfElf' },
- { view: 'Halbelf (Mal des Entdeckens)', value: 'HalfElfDetection' },
- { view: 'Halbling', value: 'Halfling' },
- { view: 'Gnom', value: 'Gnome' },
- { view: 'Halbork', value: 'HalfOrc' },
- { view: 'Tiefling', value: 'Tiefling' },
- ];
- // TODO: Implement the classes
- public classes: characterData[] = [
- { view: 'Test', value: 'Test' },
- { view: 'Barbar', value: 'Barbarian' },
- { view: 'Barde', value: 'Bard' },
- { view: 'Druide', value: 'Druid' },
- { view: 'Hexenmeister', value: 'Warlock' },
- { view: 'Kämpfer', value: 'Fighter' },
- { view: 'Kleriker', value: 'Cleric' },
- { view: 'Magier', value: 'Wizard' },
- { view: 'Mönch', value: 'Monk' },
- { view: 'Paladin', value: 'Paladin' },
- { view: 'Schurke', value: 'Rogue' },
- { view: 'Waldläufer', value: 'Ranger' },
- { view: 'Zauberer', value: 'Sorcerer' },
- ];
- public backgrounds: characterData[] = [
- { view: 'Akolyth', value: 'acolyte' },
- { view: 'Scharlatan', value: 'charlatan' },
- { view: 'Edelmann', value: 'noble' },
- { view: 'Entertainer', value: 'entertainer' },
- { view: 'Folk Held', value: 'folkHero' },
- { view: 'Gelehrter', value: 'sage' },
- { view: 'Gladiator', value: 'gladiator' },
- { view: 'Gildenhändler', value: 'guildArtisan' },
- { view: 'Gildehandwerker', value: 'guildMerchant' },
- { view: 'Herumtreiber', value: 'outlander' },
- { view: 'Krimineller', value: 'criminal' },
- { view: 'Künstler', value: 'artist' },
- { view: 'Marine', value: 'sailor' },
- { view: 'Scharlatan', value: 'charlatan' },
- { view: 'Soldat', value: 'soldier' },
- { view: 'Stadtwache', value: 'cityWatch' },
- { view: 'Urchin', value: 'urchin' },
- ];
- public genders: characterData[] = [
- { view: 'Weiblich', value: 'Female' },
- { view: 'Männlich', value: 'Male' },
- { view: 'Divers', value: 'Diverse' },
- ];
- // Predefined Data
- private hitDice: any = {
- Barbarian: 12,
- Bard: 8,
- Cleric: 8,
- Druid: 8,
- Fighter: 10,
- Monk: 8,
- Paladin: 10,
- Ranger: 10,
- Rogue: 8,
- Sorcerer: 6,
- Warlock: 8,
- Wizard: 6,
- };
- public spellcastingAttributes: any = {
- Barbarian: null,
- Bard: 'Charisma',
- Cleric: 'Wisdom',
- Druid: 'Wisdom',
- Fighter: null,
- Monk: 'Wisdom',
- Paladin: 'Charisma',
- Ranger: 'Wisdom',
- Rogue: 'Intelligence',
- Sorcerer: 'Charisma',
- Warlock: 'Charisma',
- Wizard: 'Intelligence',
- };
- public characterName: string = '';
- public characterClass: string = '';
- public characterSpecies: string = '';
- public characterBackground: string = '';
- public characterGender: string = '';
- public constructor(
- public dataAccessor: DataService,
- private Router: Router
- ) {}
- public async createCharacter(): Promise<void> {
- console.log(this.characterName);
- // Creates a new entry in the character collection
- this.dataAccessor.addData('characters', { name: this.characterName });
- // Creates a new collection with the character name
- this.createNewCharacterInDatabase().then(() => {
- // Die Funktion muss ertstmal durchlaufen, bevor der Character ausgewählt werden kann
- sessionStorage.setItem('characterName', this.characterName);
- this.dataAccessor.dataLoaded = false;
- this.Router.navigate(['journal']);
- });
- }
- public async createNewCharacterInDatabase(): Promise<void> {
- // TODO: Für alle Daten einen eigenen Key/Value Eintrag anlegen addData(collection: string, data: any, key?: string): void
- return Promise.all([
- // Character Data
- this.dataAccessor.addData(
- this.characterName,
- {
- class: this.characterClass,
- subclass: '',
- race: this.characterSpecies,
- background: this.characterBackground,
- level: 1,
- experience: 0,
- image: '',
- gender: this.characterGender,
- age: '',
- height: '',
- weight: '',
- eyes: '',
- skin: '',
- hair: '',
- },
- 'characterData'
- ),
- // Character Image
- this.dataAccessor.addData(
- this.characterName,
- {
- value: undefined,
- },
- 'image'
- ),
- // Character Attributes
- this.dataAccessor.addData(
- this.characterName,
- {
- strength: { name: 'strength', value: 10, proficiency: false },
- dexterity: { name: 'dexterity', value: 10, proficiency: false },
- constitution: { name: 'constitution', value: 10, proficiency: false },
- intelligence: { name: 'intelligence', value: 10, proficiency: false },
- wisdom: { name: 'wisdom', value: 10, proficiency: false },
- charisma: { name: 'charisma', value: 10, proficiency: false },
- },
- 'attributes'
- ),
- // Character Skills
- this.dataAccessor.addData(
- this.characterName,
- {
- acrobatics: { name: 'acrobatics', proficiency: false },
- animalHandling: { name: 'animalHandling', proficiency: false },
- arcana: { name: 'arcana', proficiency: false },
- athletics: { name: 'athletics', proficiency: false },
- deception: { name: 'deception', proficiency: false },
- history: { name: 'history', proficiency: false },
- insight: { name: 'insight', proficiency: false },
- intimidation: { name: 'intimidation', proficiency: false },
- investigation: { name: 'investigation', proficiency: false },
- medicine: { name: 'medicine', proficiency: false },
- nature: { name: 'nature', proficiency: false },
- perception: { name: 'perception', proficiency: false },
- performance: { name: 'performance', proficiency: false },
- persuasion: { name: 'persuasion', proficiency: false },
- religion: { name: 'religion', proficiency: false },
- sleightOfHand: { name: 'sleightOfHand', proficiency: false },
- stealth: { name: 'stealth', proficiency: false },
- survival: { name: 'survival', proficiency: false },
- },
- 'skills'
- ),
- // Character Combat Stats
- this.dataAccessor.addData(
- this.characterName,
- {
- armorClass: 10,
- initiative: 0,
- movement: 30,
- deathSaves: [0, 0],
- proficiencyBonus: 2,
- conditions: [],
- exhaustion: 0,
- inspiration: false,
- },
- 'combatStats'
- ),
- // Character Hit Points
- this.dataAccessor.addData(
- this.characterName,
- {
- hitPoints: {
- maxHitPoints: 10,
- currentHitPoints: 10,
- temporaryHitPoints: 0,
- },
- hitDice: {
- diceNumber: 1,
- diceType: this.hitDice[this.characterClass],
- diceUsed: 0,
- },
- },
- 'hitPoints'
- ),
- // Character Abilities
- this.dataAccessor.addData(
- this.characterName,
- {
- data: [],
- },
- 'abilities'
- ),
- // Character Traits
- this.dataAccessor.addData(
- this.characterName,
- {
- data: [],
- },
- 'traits'
- ),
- // Character Proficiencies
- this.dataAccessor.addData(
- this.characterName,
- {
- light: false,
- medium: false,
- heavy: false,
- shields: false,
- simple: false,
- martial: false,
- other: [],
- tools: [],
- languages: ['Gemeinsprache'],
- },
- 'proficiencies'
- ),
- // Character Spellslots
- this.dataAccessor.addData(
- this.characterName,
- {
- spellslots: [],
- showSpellslots: false,
- spellcastingAttribute:
- this.spellcastingAttributes[this.characterClass],
- },
- 'spellslots'
- ),
- // Ki Points
- this.dataAccessor.addData(
- this.characterName,
- {
- totalPoints: 0,
- usedPoints: 0,
- showKiPoints: false,
- },
- 'kiPoints'
- ),
- // Weapons
- this.dataAccessor.addData(
- this.characterName,
- {
- data: [],
- },
- 'favoriteWeapons'
- ),
- // WEAPONS AND ARMOR
- this.dataAccessor.addData(
- this.characterName,
- {
- data: [],
- },
- 'weaponsAndArmor'
- ),
- // MISCELLANEOUS
- this.dataAccessor.addData(
- this.characterName,
- {
- data: [],
- },
- 'miscellaneous'
- ),
- // CONSUMABLES
- this.dataAccessor.addData(
- this.characterName,
- {
- data: [],
- },
- 'consumables'
- ),
- // MONEY
- this.dataAccessor.addData(
- this.characterName,
- {
- platinum: 0,
- gold: 0,
- silver: 0,
- copper: 0,
- },
- 'money'
- ),
- // FOOD
- this.dataAccessor.addData(
- this.characterName,
- {
- data: [],
- },
- 'food'
- ),
- // Favorite Spells
- this.dataAccessor.addData(
- this.characterName,
- {
- spells: [],
- },
- 'favoriteSpells'
- ),
- // Spells
- this.dataAccessor.addData(
- this.characterName,
- {
- spells: [],
- id: 10000,
- },
- 'customSpells'
- ),
- this.dataAccessor.addData(
- this.characterName,
- {
- spells: [],
- },
- 'spellLevel0'
- ),
- this.dataAccessor.addData(
- this.characterName,
- {
- spells: [],
- },
- 'spellLevel1'
- ),
- this.dataAccessor.addData(
- this.characterName,
- {
- spells: [],
- },
- 'spellLevel2'
- ),
- this.dataAccessor.addData(
- this.characterName,
- {
- spells: [],
- },
- 'spellLevel3'
- ),
- this.dataAccessor.addData(
- this.characterName,
- {
- spells: [],
- },
- 'spellLevel4'
- ),
- this.dataAccessor.addData(
- this.characterName,
- {
- spells: [],
- },
- 'spellLevel5'
- ),
- this.dataAccessor.addData(
- this.characterName,
- {
- spells: [],
- },
- 'spellLevel6'
- ),
- this.dataAccessor.addData(
- this.characterName,
- {
- spells: [],
- },
- 'spellLevel7'
- ),
- this.dataAccessor.addData(
- this.characterName,
- {
- spells: [],
- },
- 'spellLevel8'
- ),
- this.dataAccessor.addData(
- this.characterName,
- {
- spells: [],
- },
- 'spellLevel9'
- ),
- // Notes
- // Maps
- // NPCs
- // Quests
- ]).then(() => {});
- }
- }
|