فهرست منبع

All values but the save throws are persitent now.

Warafear 1 سال پیش
والد
کامیت
6699e7dfa9
34فایلهای تغییر یافته به همراه1092 افزوده شده و 754 حذف شده
  1. 288 0
      .nx/cache/d/daemon.log
  2. 1 1
      .nx/cache/d/server-process.json
  3. 2 2
      src/app/character/character-creator/character-creator.component.html
  4. 256 63
      src/app/character/character-creator/character-creator.component.ts
  5. 2 1
      src/app/character/character-picker/character-picker.component.ts
  6. 4 1
      src/app/journal/journal-home/journal-home.component.ts
  7. 1 1
      src/app/journal/journal-home/navigation-panel/navigation-panel.component.html
  8. 4 4
      src/app/journal/journal-inventory/journal-inventory.component.ts
  9. 4 0
      src/app/journal/journal-routing.module.ts
  10. 89 20
      src/app/journal/journal-spellcards/journal-spellcards.component.ts
  11. 2 2
      src/app/journal/journal-stats/ability-panel/ability-table/ability-table.component.ts
  12. 2 2
      src/app/journal/journal-stats/ability-panel/proficiencies-table/proficiencies-table.component.ts
  13. 10 5
      src/app/journal/journal-stats/ability-panel/spellslots/spellslots.component.ts
  14. 2 2
      src/app/journal/journal-stats/ability-panel/trait-table/trait-table.component.ts
  15. 1 1
      src/app/journal/journal-stats/attribute-skill-container/attribute-panel/attribute-field/attribute-field.component.html
  16. 14 6
      src/app/journal/journal-stats/attribute-skill-container/attribute-panel/attribute-field/attribute-field.component.scss
  17. 0 20
      src/app/journal/journal-stats/attribute-skill-container/attribute-panel/attribute-field/attribute-field.component.ts
  18. 4 1
      src/app/journal/journal-stats/attribute-skill-container/save-throw-panel/save-throw-field/save-throw-field.component.html
  19. 19 3
      src/app/journal/journal-stats/attribute-skill-container/save-throw-panel/save-throw-field/save-throw-field.component.ts
  20. 9 9
      src/app/journal/journal-stats/attribute-skill-container/skill-panel/skill-field/skill-field.component.ts
  21. 9 9
      src/app/journal/journal-stats/attribute-skill-container/skill-panel/skill-panel.component.ts
  22. 1 0
      src/app/journal/journal-stats/info-row/conditions/conditions.component.html
  23. 2 1
      src/app/journal/journal-stats/info-row/conditions/conditions.component.ts
  24. 2 5
      src/app/journal/journal-stats/info-row/proficiency/proficiency-field.component.ts
  25. 1 0
      src/app/journal/journal-stats/life-container/life/life.component.html
  26. 7 4
      src/app/journal/journal-stats/life-container/life/life.component.ts
  27. 1 1
      src/app/journal/journal-stats/weapons-container/spell-table/spell-table.component.ts
  28. 2 2
      src/app/journal/journal-stats/weapons-container/weapon-table/weapon-table.component.ts
  29. 6 2
      src/app/shared-components/full-spellcard/full-spellcard.component.html
  30. 9 0
      src/app/shared-components/full-spellcard/full-spellcard.component.scss
  31. 1 0
      src/app/shared-components/full-spellcard/full-spellcard.component.ts
  32. 307 586
      src/services/data/data.service.ts
  33. 16 0
      src/services/dataResolve/data-resolver.service.spec.ts
  34. 14 0
      src/services/dataResolve/data-resolver.service.ts

+ 288 - 0
.nx/cache/d/daemon.log

@@ -461258,3 +461258,291 @@ To fix this, set a unique name for each project in a project.json inside the pro
     at async processFilesAndCreateAndSerializeProjectGraph (c:\Softwareprojekte\DnD\node_modules\nx\src\daemon\server\project-graph-incremental-recomputation.js:138:17)
 [NX Daemon Server] - 2023-12-14T07:55:32.279Z - Time taken for 'hash changed files from watcher' 11.233600000006845ms
 [NX Daemon Server] - 2023-12-14T07:55:32.280Z - Done responding to the client null
+[NX Daemon Server] - 2023-12-14T14:36:09.300Z - Started listening on: \\.\pipe\nx\C:\Users\chris\AppData\Local\Temp\83d14e7134fc08a15480\d.sock
+[NX Daemon Server] - 2023-12-14T14:36:09.311Z - [WATCHER]: Subscribed to changes within: c:\Softwareprojekte\DnD (native)
+[NX Daemon Server] - 2023-12-14T14:36:09.312Z - Established a connection. Number of open connections: 1
+[NX Daemon Server] - 2023-12-14T14:36:09.313Z - Established a connection. Number of open connections: 2
+[NX Daemon Server] - 2023-12-14T14:36:09.315Z - Closed a connection. Number of open connections: 1
+[NX Daemon Server] - 2023-12-14T14:36:09.316Z - [REQUEST]: Client Request for Project Graph Received
+[NX Daemon Server] - 2023-12-14T14:36:10.100Z - Error detected when recomputing project file map: The following projects are defined in multiple locations:
+- DnDTools: 
+  - 
+  - .
+
+To fix this, set a unique name for each project in a project.json inside the project's root. If the project does not currently have a project.json, you can create one that contains only a name.
+[NX Daemon Server] - 2023-12-14T14:36:10.100Z - [REQUEST]: Responding to the client with an error. Error when preparing serialized project graph. The following projects are defined in multiple locations:
+- DnDTools: 
+  - 
+  - .
+
+To fix this, set a unique name for each project in a project.json inside the project's root. If the project does not currently have a project.json, you can create one that contains only a name.
+Error: The following projects are defined in multiple locations:
+- DnDTools: 
+  - 
+  - .
+
+To fix this, set a unique name for each project in a project.json inside the project's root. If the project does not currently have a project.json, you can create one that contains only a name.
+    at readProjectConfigurationsFromRootMap (c:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\project-configuration-utils.js:97:15)
+    at buildProjectsConfigurationsFromProjectPathsAndPlugins (c:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\project-configuration-utils.js:70:19)
+    at createProjectConfigurations (c:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:131:129)
+    at WorkspaceContext.<anonymous> (c:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:82:39)
+    at getProjectConfigurationsFromContext (c:\Softwareprojekte\DnD\node_modules\nx\src\utils\workspace-context.js:26:29)
+    at _retrieveProjectConfigurations (c:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:81:72)
+    at retrieveProjectConfigurations (c:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:58:12)
+    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
+    at async processCollectedUpdatedAndDeletedFiles (c:\Softwareprojekte\DnD\node_modules\nx\src\daemon\server\project-graph-incremental-recomputation.js:102:34)
+    at async processFilesAndCreateAndSerializeProjectGraph (c:\Softwareprojekte\DnD\node_modules\nx\src\daemon\server\project-graph-incremental-recomputation.js:138:17)
+[NX Daemon Server] - 2023-12-14T14:36:10.101Z - Time taken for 'hash changed files from watcher' 26.30920000001788ms
+[NX Daemon Server] - 2023-12-14T14:36:10.102Z - Done responding to the client null
+[NX Daemon Server] - 2023-12-14T17:21:04.391Z - Started listening on: \\.\pipe\nx\C:\Users\chris\AppData\Local\Temp\83d14e7134fc08a15480\d.sock
+[NX Daemon Server] - 2023-12-14T17:21:04.397Z - [WATCHER]: Subscribed to changes within: C:\Softwareprojekte\DnD (native)
+[NX Daemon Server] - 2023-12-14T17:21:04.402Z - Established a connection. Number of open connections: 1
+[NX Daemon Server] - 2023-12-14T17:21:04.404Z - Closed a connection. Number of open connections: 0
+[NX Daemon Server] - 2023-12-14T17:21:04.404Z - Established a connection. Number of open connections: 1
+[NX Daemon Server] - 2023-12-14T17:21:04.406Z - [REQUEST]: Client Request for Project Graph Received
+[NX Daemon Server] - 2023-12-14T17:21:04.495Z - Error detected when recomputing project file map: The following projects are defined in multiple locations:
+- DnDTools: 
+  - 
+  - .
+
+To fix this, set a unique name for each project in a project.json inside the project's root. If the project does not currently have a project.json, you can create one that contains only a name.
+[NX Daemon Server] - 2023-12-14T17:21:04.495Z - [REQUEST]: Responding to the client with an error. Error when preparing serialized project graph. The following projects are defined in multiple locations:
+- DnDTools: 
+  - 
+  - .
+
+To fix this, set a unique name for each project in a project.json inside the project's root. If the project does not currently have a project.json, you can create one that contains only a name.
+Error: The following projects are defined in multiple locations:
+- DnDTools: 
+  - 
+  - .
+
+To fix this, set a unique name for each project in a project.json inside the project's root. If the project does not currently have a project.json, you can create one that contains only a name.
+    at readProjectConfigurationsFromRootMap (C:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\project-configuration-utils.js:97:15)
+    at buildProjectsConfigurationsFromProjectPathsAndPlugins (C:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\project-configuration-utils.js:70:19)
+    at createProjectConfigurations (C:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:131:129)
+    at WorkspaceContext.<anonymous> (C:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:82:39)
+    at getProjectConfigurationsFromContext (C:\Softwareprojekte\DnD\node_modules\nx\src\utils\workspace-context.js:26:29)
+    at _retrieveProjectConfigurations (C:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:81:72)
+    at retrieveProjectConfigurations (C:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:58:12)
+    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
+    at async processCollectedUpdatedAndDeletedFiles (C:\Softwareprojekte\DnD\node_modules\nx\src\daemon\server\project-graph-incremental-recomputation.js:102:34)
+    at async processFilesAndCreateAndSerializeProjectGraph (C:\Softwareprojekte\DnD\node_modules\nx\src\daemon\server\project-graph-incremental-recomputation.js:138:17)
+[NX Daemon Server] - 2023-12-14T17:21:04.498Z - Time taken for 'hash changed files from watcher' 27.734499998390675ms
+[NX Daemon Server] - 2023-12-14T17:21:04.500Z - Done responding to the client null
+[NX Daemon Server] - 2023-12-14T19:50:24.002Z - Started listening on: \\.\pipe\nx\C:\Users\chris\AppData\Local\Temp\83d14e7134fc08a15480\d.sock
+[NX Daemon Server] - 2023-12-14T19:50:24.005Z - [WATCHER]: Subscribed to changes within: C:\Softwareprojekte\DnD (native)
+[NX Daemon Server] - 2023-12-14T19:50:24.012Z - Established a connection. Number of open connections: 1
+[NX Daemon Server] - 2023-12-14T19:50:24.015Z - Closed a connection. Number of open connections: 0
+[NX Daemon Server] - 2023-12-14T19:50:24.015Z - Established a connection. Number of open connections: 1
+[NX Daemon Server] - 2023-12-14T19:50:24.018Z - [REQUEST]: Client Request for Project Graph Received
+[NX Daemon Server] - 2023-12-14T19:50:24.113Z - Error detected when recomputing project file map: The following projects are defined in multiple locations:
+- DnDTools: 
+  - 
+  - .
+
+To fix this, set a unique name for each project in a project.json inside the project's root. If the project does not currently have a project.json, you can create one that contains only a name.
+[NX Daemon Server] - 2023-12-14T19:50:24.113Z - [REQUEST]: Responding to the client with an error. Error when preparing serialized project graph. The following projects are defined in multiple locations:
+- DnDTools: 
+  - 
+  - .
+
+To fix this, set a unique name for each project in a project.json inside the project's root. If the project does not currently have a project.json, you can create one that contains only a name.
+Error: The following projects are defined in multiple locations:
+- DnDTools: 
+  - 
+  - .
+
+To fix this, set a unique name for each project in a project.json inside the project's root. If the project does not currently have a project.json, you can create one that contains only a name.
+    at readProjectConfigurationsFromRootMap (C:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\project-configuration-utils.js:97:15)
+    at buildProjectsConfigurationsFromProjectPathsAndPlugins (C:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\project-configuration-utils.js:70:19)
+    at createProjectConfigurations (C:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:131:129)
+    at WorkspaceContext.<anonymous> (C:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:82:39)
+    at getProjectConfigurationsFromContext (C:\Softwareprojekte\DnD\node_modules\nx\src\utils\workspace-context.js:26:29)
+    at _retrieveProjectConfigurations (C:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:81:72)
+    at retrieveProjectConfigurations (C:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:58:12)
+    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
+    at async processCollectedUpdatedAndDeletedFiles (C:\Softwareprojekte\DnD\node_modules\nx\src\daemon\server\project-graph-incremental-recomputation.js:102:34)
+    at async processFilesAndCreateAndSerializeProjectGraph (C:\Softwareprojekte\DnD\node_modules\nx\src\daemon\server\project-graph-incremental-recomputation.js:138:17)
+[NX Daemon Server] - 2023-12-14T19:50:24.115Z - Time taken for 'hash changed files from watcher' 40.100500002503395ms
+[NX Daemon Server] - 2023-12-14T19:50:24.116Z - Done responding to the client null
+[NX Daemon Server] - 2023-12-14T20:19:22.262Z - Started listening on: \\.\pipe\nx\C:\Users\chris\AppData\Local\Temp\83d14e7134fc08a15480\d.sock
+[NX Daemon Server] - 2023-12-14T20:19:22.264Z - [WATCHER]: Subscribed to changes within: C:\Softwareprojekte\DnD (native)
+[NX Daemon Server] - 2023-12-14T20:19:22.274Z - Established a connection. Number of open connections: 1
+[NX Daemon Server] - 2023-12-14T20:19:22.276Z - Closed a connection. Number of open connections: 0
+[NX Daemon Server] - 2023-12-14T20:19:22.277Z - Established a connection. Number of open connections: 1
+[NX Daemon Server] - 2023-12-14T20:19:22.278Z - [REQUEST]: Client Request for Project Graph Received
+[NX Daemon Server] - 2023-12-14T20:19:22.351Z - Error detected when recomputing project file map: The following projects are defined in multiple locations:
+- DnDTools: 
+  - 
+  - .
+
+To fix this, set a unique name for each project in a project.json inside the project's root. If the project does not currently have a project.json, you can create one that contains only a name.
+[NX Daemon Server] - 2023-12-14T20:19:22.351Z - [REQUEST]: Responding to the client with an error. Error when preparing serialized project graph. The following projects are defined in multiple locations:
+- DnDTools: 
+  - 
+  - .
+
+To fix this, set a unique name for each project in a project.json inside the project's root. If the project does not currently have a project.json, you can create one that contains only a name.
+Error: The following projects are defined in multiple locations:
+- DnDTools: 
+  - 
+  - .
+
+To fix this, set a unique name for each project in a project.json inside the project's root. If the project does not currently have a project.json, you can create one that contains only a name.
+    at readProjectConfigurationsFromRootMap (C:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\project-configuration-utils.js:97:15)
+    at buildProjectsConfigurationsFromProjectPathsAndPlugins (C:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\project-configuration-utils.js:70:19)
+    at createProjectConfigurations (C:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:131:129)
+    at WorkspaceContext.<anonymous> (C:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:82:39)
+    at getProjectConfigurationsFromContext (C:\Softwareprojekte\DnD\node_modules\nx\src\utils\workspace-context.js:26:29)
+    at _retrieveProjectConfigurations (C:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:81:72)
+    at retrieveProjectConfigurations (C:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:58:12)
+    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
+    at async processCollectedUpdatedAndDeletedFiles (C:\Softwareprojekte\DnD\node_modules\nx\src\daemon\server\project-graph-incremental-recomputation.js:102:34)
+    at async processFilesAndCreateAndSerializeProjectGraph (C:\Softwareprojekte\DnD\node_modules\nx\src\daemon\server\project-graph-incremental-recomputation.js:138:17)
+[NX Daemon Server] - 2023-12-14T20:19:22.352Z - Time taken for 'hash changed files from watcher' 26.725000001490116ms
+[NX Daemon Server] - 2023-12-14T20:19:22.354Z - Done responding to the client null
+[NX Daemon Server] - 2023-12-15T07:29:32.292Z - Started listening on: \\.\pipe\nx\C:\Users\chris\AppData\Local\Temp\83d14e7134fc08a15480\d.sock
+[NX Daemon Server] - 2023-12-15T07:29:32.295Z - [WATCHER]: Subscribed to changes within: c:\Softwareprojekte\DnD (native)
+[NX Daemon Server] - 2023-12-15T07:29:32.296Z - Established a connection. Number of open connections: 1
+[NX Daemon Server] - 2023-12-15T07:29:32.297Z - Established a connection. Number of open connections: 2
+[NX Daemon Server] - 2023-12-15T07:29:32.299Z - Closed a connection. Number of open connections: 1
+[NX Daemon Server] - 2023-12-15T07:29:32.301Z - [REQUEST]: Client Request for Project Graph Received
+[NX Daemon Server] - 2023-12-15T07:29:32.898Z - Error detected when recomputing project file map: The following projects are defined in multiple locations:
+- DnDTools: 
+  - 
+  - .
+
+To fix this, set a unique name for each project in a project.json inside the project's root. If the project does not currently have a project.json, you can create one that contains only a name.
+[NX Daemon Server] - 2023-12-15T07:29:32.898Z - [REQUEST]: Responding to the client with an error. Error when preparing serialized project graph. The following projects are defined in multiple locations:
+- DnDTools: 
+  - 
+  - .
+
+To fix this, set a unique name for each project in a project.json inside the project's root. If the project does not currently have a project.json, you can create one that contains only a name.
+Error: The following projects are defined in multiple locations:
+- DnDTools: 
+  - 
+  - .
+
+To fix this, set a unique name for each project in a project.json inside the project's root. If the project does not currently have a project.json, you can create one that contains only a name.
+    at readProjectConfigurationsFromRootMap (c:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\project-configuration-utils.js:97:15)
+    at buildProjectsConfigurationsFromProjectPathsAndPlugins (c:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\project-configuration-utils.js:70:19)
+    at createProjectConfigurations (c:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:131:129)
+    at WorkspaceContext.<anonymous> (c:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:82:39)
+    at getProjectConfigurationsFromContext (c:\Softwareprojekte\DnD\node_modules\nx\src\utils\workspace-context.js:26:29)
+    at _retrieveProjectConfigurations (c:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:81:72)
+    at retrieveProjectConfigurations (c:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:58:12)
+    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
+    at async processCollectedUpdatedAndDeletedFiles (c:\Softwareprojekte\DnD\node_modules\nx\src\daemon\server\project-graph-incremental-recomputation.js:102:34)
+    at async processFilesAndCreateAndSerializeProjectGraph (c:\Softwareprojekte\DnD\node_modules\nx\src\daemon\server\project-graph-incremental-recomputation.js:138:17)
+[NX Daemon Server] - 2023-12-15T07:29:32.899Z - Time taken for 'hash changed files from watcher' 26.047799989581108ms
+[NX Daemon Server] - 2023-12-15T07:29:32.900Z - Done responding to the client null
+[NX Daemon Server] - 2023-12-15T12:12:13.256Z - Started listening on: \\.\pipe\nx\C:\Users\chris\AppData\Local\Temp\83d14e7134fc08a15480\d.sock
+[NX Daemon Server] - 2023-12-15T12:12:13.258Z - [WATCHER]: Subscribed to changes within: c:\Softwareprojekte\DnD (native)
+[NX Daemon Server] - 2023-12-15T12:12:13.264Z - Established a connection. Number of open connections: 1
+[NX Daemon Server] - 2023-12-15T12:12:13.266Z - Closed a connection. Number of open connections: 0
+[NX Daemon Server] - 2023-12-15T12:12:13.266Z - Established a connection. Number of open connections: 1
+[NX Daemon Server] - 2023-12-15T12:12:13.268Z - [REQUEST]: Client Request for Project Graph Received
+[NX Daemon Server] - 2023-12-15T12:12:13.763Z - Error detected when recomputing project file map: The following projects are defined in multiple locations:
+- DnDTools: 
+  - 
+  - .
+
+To fix this, set a unique name for each project in a project.json inside the project's root. If the project does not currently have a project.json, you can create one that contains only a name.
+[NX Daemon Server] - 2023-12-15T12:12:13.763Z - [REQUEST]: Responding to the client with an error. Error when preparing serialized project graph. The following projects are defined in multiple locations:
+- DnDTools: 
+  - 
+  - .
+
+To fix this, set a unique name for each project in a project.json inside the project's root. If the project does not currently have a project.json, you can create one that contains only a name.
+Error: The following projects are defined in multiple locations:
+- DnDTools: 
+  - 
+  - .
+
+To fix this, set a unique name for each project in a project.json inside the project's root. If the project does not currently have a project.json, you can create one that contains only a name.
+    at readProjectConfigurationsFromRootMap (c:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\project-configuration-utils.js:97:15)
+    at buildProjectsConfigurationsFromProjectPathsAndPlugins (c:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\project-configuration-utils.js:70:19)
+    at createProjectConfigurations (c:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:131:129)
+    at WorkspaceContext.<anonymous> (c:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:82:39)
+    at getProjectConfigurationsFromContext (c:\Softwareprojekte\DnD\node_modules\nx\src\utils\workspace-context.js:26:29)
+    at _retrieveProjectConfigurations (c:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:81:72)
+    at retrieveProjectConfigurations (c:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:58:12)
+    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
+    at async processCollectedUpdatedAndDeletedFiles (c:\Softwareprojekte\DnD\node_modules\nx\src\daemon\server\project-graph-incremental-recomputation.js:102:34)
+    at async processFilesAndCreateAndSerializeProjectGraph (c:\Softwareprojekte\DnD\node_modules\nx\src\daemon\server\project-graph-incremental-recomputation.js:138:17)
+[NX Daemon Server] - 2023-12-15T12:12:13.764Z - Time taken for 'hash changed files from watcher' 28.11429999768734ms
+[NX Daemon Server] - 2023-12-15T12:12:13.765Z - Done responding to the client null
+[NX Daemon Server] - 2023-12-15T14:01:44.350Z - Started listening on: \\.\pipe\nx\C:\Users\chris\AppData\Local\Temp\83d14e7134fc08a15480\d.sock
+[NX Daemon Server] - 2023-12-15T14:01:44.354Z - [WATCHER]: Subscribed to changes within: c:\Softwareprojekte\DnD (native)
+[NX Daemon Server] - 2023-12-15T14:01:44.370Z - Established a connection. Number of open connections: 1
+[NX Daemon Server] - 2023-12-15T14:01:44.372Z - Closed a connection. Number of open connections: 0
+[NX Daemon Server] - 2023-12-15T14:01:44.372Z - Established a connection. Number of open connections: 1
+[NX Daemon Server] - 2023-12-15T14:01:44.374Z - [REQUEST]: Client Request for Project Graph Received
+[NX Daemon Server] - 2023-12-15T14:01:45.124Z - Error detected when recomputing project file map: The following projects are defined in multiple locations:
+- DnDTools: 
+  - 
+  - .
+
+To fix this, set a unique name for each project in a project.json inside the project's root. If the project does not currently have a project.json, you can create one that contains only a name.
+[NX Daemon Server] - 2023-12-15T14:01:45.124Z - [REQUEST]: Responding to the client with an error. Error when preparing serialized project graph. The following projects are defined in multiple locations:
+- DnDTools: 
+  - 
+  - .
+
+To fix this, set a unique name for each project in a project.json inside the project's root. If the project does not currently have a project.json, you can create one that contains only a name.
+Error: The following projects are defined in multiple locations:
+- DnDTools: 
+  - 
+  - .
+
+To fix this, set a unique name for each project in a project.json inside the project's root. If the project does not currently have a project.json, you can create one that contains only a name.
+    at readProjectConfigurationsFromRootMap (c:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\project-configuration-utils.js:97:15)
+    at buildProjectsConfigurationsFromProjectPathsAndPlugins (c:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\project-configuration-utils.js:70:19)
+    at createProjectConfigurations (c:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:131:129)
+    at WorkspaceContext.<anonymous> (c:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:82:39)
+    at getProjectConfigurationsFromContext (c:\Softwareprojekte\DnD\node_modules\nx\src\utils\workspace-context.js:26:29)
+    at _retrieveProjectConfigurations (c:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:81:72)
+    at retrieveProjectConfigurations (c:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:58:12)
+    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
+    at async processCollectedUpdatedAndDeletedFiles (c:\Softwareprojekte\DnD\node_modules\nx\src\daemon\server\project-graph-incremental-recomputation.js:102:34)
+    at async processFilesAndCreateAndSerializeProjectGraph (c:\Softwareprojekte\DnD\node_modules\nx\src\daemon\server\project-graph-incremental-recomputation.js:138:17)
+[NX Daemon Server] - 2023-12-15T14:01:45.125Z - Time taken for 'hash changed files from watcher' 0.8941999971866608ms
+[NX Daemon Server] - 2023-12-15T14:01:45.126Z - Done responding to the client null
+[NX Daemon Server] - 2023-12-15T16:02:38.684Z - Started listening on: \\.\pipe\nx\C:\Users\chris\AppData\Local\Temp\83d14e7134fc08a15480\d.sock
+[NX Daemon Server] - 2023-12-15T16:02:38.688Z - [WATCHER]: Subscribed to changes within: C:\Softwareprojekte\DnD (native)
+[NX Daemon Server] - 2023-12-15T16:02:38.689Z - Established a connection. Number of open connections: 1
+[NX Daemon Server] - 2023-12-15T16:02:38.689Z - Established a connection. Number of open connections: 2
+[NX Daemon Server] - 2023-12-15T16:02:38.691Z - Closed a connection. Number of open connections: 1
+[NX Daemon Server] - 2023-12-15T16:02:38.694Z - [REQUEST]: Client Request for Project Graph Received
+[NX Daemon Server] - 2023-12-15T16:02:38.790Z - Error detected when recomputing project file map: The following projects are defined in multiple locations:
+- DnDTools: 
+  - 
+  - .
+
+To fix this, set a unique name for each project in a project.json inside the project's root. If the project does not currently have a project.json, you can create one that contains only a name.
+[NX Daemon Server] - 2023-12-15T16:02:38.791Z - [REQUEST]: Responding to the client with an error. Error when preparing serialized project graph. The following projects are defined in multiple locations:
+- DnDTools: 
+  - 
+  - .
+
+To fix this, set a unique name for each project in a project.json inside the project's root. If the project does not currently have a project.json, you can create one that contains only a name.
+Error: The following projects are defined in multiple locations:
+- DnDTools: 
+  - 
+  - .
+
+To fix this, set a unique name for each project in a project.json inside the project's root. If the project does not currently have a project.json, you can create one that contains only a name.
+    at readProjectConfigurationsFromRootMap (C:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\project-configuration-utils.js:97:15)
+    at buildProjectsConfigurationsFromProjectPathsAndPlugins (C:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\project-configuration-utils.js:70:19)
+    at createProjectConfigurations (C:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:131:129)
+    at WorkspaceContext.<anonymous> (C:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:82:39)
+    at getProjectConfigurationsFromContext (C:\Softwareprojekte\DnD\node_modules\nx\src\utils\workspace-context.js:26:29)
+    at _retrieveProjectConfigurations (C:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:81:72)
+    at retrieveProjectConfigurations (C:\Softwareprojekte\DnD\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:58:12)
+    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
+    at async processCollectedUpdatedAndDeletedFiles (C:\Softwareprojekte\DnD\node_modules\nx\src\daemon\server\project-graph-incremental-recomputation.js:102:34)
+    at async processFilesAndCreateAndSerializeProjectGraph (C:\Softwareprojekte\DnD\node_modules\nx\src\daemon\server\project-graph-incremental-recomputation.js:138:17)
+[NX Daemon Server] - 2023-12-15T16:02:38.795Z - Time taken for 'hash changed files from watcher' 38.62120001018047ms
+[NX Daemon Server] - 2023-12-15T16:02:38.796Z - Done responding to the client null

+ 1 - 1
.nx/cache/d/server-process.json

@@ -1 +1 @@
-{"processId":19444}
+{"processId":1964}

+ 2 - 2
src/app/character/character-creator/character-creator.component.html

@@ -1,7 +1,7 @@
 <div>
   <div>
-    <label>Character Name</label>
+    <label>Name</label>
     <input [(ngModel)]="characterName" />
   </div>
-  <button (click)="createCharacter()">Create Character</button>
+  <button (click)="createCharacter()">Neuen Charakter erstellen</button>
 </div>

+ 256 - 63
src/app/character/character-creator/character-creator.component.ts

@@ -8,24 +8,30 @@ import { Router } from '@angular/router';
   styleUrls: ['./character-creator.component.scss'],
 })
 export class CharacterCreatorComponent {
-  public constructor(public dataService: DataService, private Router: Router) {}
+  public constructor(
+    public dataAccessor: DataService,
+    private Router: Router
+  ) {}
 
   public characterName: string = '';
 
   public async createCharacter(): Promise<void> {
     // Creates a new entry in the character collection
-    this.dataService.addData('characters', { name: this.characterName });
-    // TODO: Animation, dass der Character erstellt wurde
-    await this.createNewCharacterInDatabase();
-    // Die Funktion muss ertstmal durchlaufen, bevor der Character ausgewählt werden kann
-    this.dataService.selectCharacter(this.characterName);
+    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.dataService.addData(
+      this.dataAccessor.addData(
         this.characterName,
         {
           name: this.characterName,
@@ -41,64 +47,136 @@ export class CharacterCreatorComponent {
         },
         'characterData'
       ),
-
       // Character Attributes
-      this.dataService.addData(
+      this.dataAccessor.addData(
         this.characterName,
         {
-          strength: ['', false],
-          dexterity: ['', false],
-          constitution: ['', false],
-          intelligence: ['', false],
-          wisdom: ['', false],
-          charisma: ['', false],
+          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 },
         },
-        'attribute'
+        'attributes'
       ),
-
       // Character Skills
-      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],
+      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.dataService.addData(
+      this.dataAccessor.addData(
         this.characterName,
         {
-          armorClass: '',
-          initiative: '',
-          speed: '',
-          hitPointMaximum: '',
-          currentHitPoints: '',
-          temporaryHitPoints: '',
-          hitDice: '',
-          deathSaveSuccesses: '',
-          deathSaveFailures: '',
+          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: {
+            hitDiceNumber: 1,
+            hitDiceType: 10,
+          },
+        },
+        '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,
+        {
+          armor: {
+            light: false,
+            medium: false,
+            heavy: false,
+          },
+          weapons: {
+            simple: false,
+            martial: false,
+            other: [],
+          },
+          tools: [],
+          languages: ['Gemeinsprache'],
+        },
+        'proficiencies'
+      ),
+
+      // Character Spellslots
+      this.dataAccessor.addData(
+        this.characterName,
+        {
+          spellslots: [],
+          showSpellslots: false,
+        },
+        'spellslots'
+      ),
+      // Ki Points
+      this.dataAccessor.addData(
+        this.characterName,
+        {
+          totalPoints: 4,
+          usedPoints: 2,
+          showKiPoints: true,
+        },
+        'kiPoints'
+      ),
+
       // Character Appearance
-      this.dataService.addData(
+      this.dataAccessor.addData(
         this.characterName,
         {
           age: '',
@@ -111,7 +189,7 @@ export class CharacterCreatorComponent {
         'appearance'
       ),
       // Character Personality
-      this.dataService.addData(
+      this.dataAccessor.addData(
         this.characterName,
         {
           personalityTraits: '',
@@ -121,25 +199,140 @@ export class CharacterCreatorComponent {
         },
         'personality'
       ),
-      // Character Weapons
-      this.dataService.addData(
+      // Weapons
+      this.dataAccessor.addData(
         this.characterName,
         {
-          name: '',
-          attackBonus: '',
-          damage: '',
-          type: '',
-          range: '',
-          description: '',
+          data: [],
         },
-        'weapons'
+        'favoriteWeapons'
       ),
-
       // Inventory
-
-      // Weapons
-
+      this.dataAccessor.addData(
+        this.characterName,
+        {
+          data: [],
+        },
+        'weaponsAndArmor'
+      ),
+      this.dataAccessor.addData(
+        this.characterName,
+        {
+          data: [],
+        },
+        'miscellaneous'
+      ),
+      this.dataAccessor.addData(
+        this.characterName,
+        {
+          data: [],
+        },
+        'consumables'
+      ),
+      this.dataAccessor.addData(
+        this.characterName,
+        {
+          data: [],
+        },
+        'money'
+      ),
+      this.dataAccessor.addData(
+        this.characterName,
+        {
+          platinum: 0,
+          gold: 0,
+          electrum: 0,
+          silver: 0,
+          copper: 0,
+        },
+        'money'
+      ),
+      this.dataAccessor.addData(
+        this.characterName,
+        {
+          data: [],
+        },
+        'food'
+      ),
+      // Favorite Spells
+      this.dataAccessor.addData(
+        this.characterName,
+        {
+          spells: [],
+        },
+        'favoriteSpells'
+      ),
       // Spells
+      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
 

+ 2 - 1
src/app/character/character-picker/character-picker.component.ts

@@ -29,6 +29,7 @@ export class CharacterPickerComponent {
   }
 
   public selectCharacter(character: string) {
-    this.dataService.selectCharacter(character);
+    sessionStorage.setItem('characterName', character);
+    this.Router.navigate(['journal']);
   }
 }

+ 4 - 1
src/app/journal/journal-home/journal-home.component.ts

@@ -1,6 +1,7 @@
 import { Component, ViewChild } from '@angular/core';
 import { NavigationPanelService } from 'src/services/navigationPanel/navigation-panel.service';
 import { Router } from '@angular/router';
+import { DataService } from 'src/services/data/data.service';
 
 @Component({
   selector: 'app-journal-home',
@@ -10,7 +11,8 @@ import { Router } from '@angular/router';
 export class JournalHomeComponent {
   public constructor(
     public navigation: NavigationPanelService,
-    private router: Router
+    private router: Router,
+    private dataAccessor: DataService
   ) {}
 
   @ViewChild('tabbar') tabbar: any;
@@ -18,6 +20,7 @@ export class JournalHomeComponent {
   private isNavigationOpen: boolean = false;
 
   ngOnInit() {
+    console.log('JournalHomeComponent');
     const width = window.innerWidth;
     this.navigation.showNavigationPanel$.subscribe((state) => {
       this.isNavigationOpen = state;

+ 1 - 1
src/app/journal/journal-home/navigation-panel/navigation-panel.component.html

@@ -107,7 +107,7 @@
   </ul>
 
   <div class="settings-container">
-    <button class="settings-button">
+    <button class="settings-button" [routerLink]="'../'">
       <icon [size]="'s'" [type]="'UI'" [icon]="'character'"></icon>
       <div>Charakterauswahl</div>
     </button>

+ 4 - 4
src/app/journal/journal-inventory/journal-inventory.component.ts

@@ -35,7 +35,7 @@ export class JournalInventoryComponent {
   public food: Food[] = [];
 
   public ngOnInit(): void {
-    this.weaponsAndArmor = this.dataAccessor.items;
+    this.weaponsAndArmor = this.dataAccessor.weaponsAndArmor;
     this.consumables = this.dataAccessor.consumables;
     this.miscellaneous = this.dataAccessor.miscellaneous;
     this.food = this.dataAccessor.food;
@@ -45,7 +45,7 @@ export class JournalInventoryComponent {
   drop(event: CdkDragDrop<string[]>, list: any[], listName: string) {
     moveItemInArray(list, event.previousIndex, event.currentIndex);
     if (listName === 'weaponsAndArmor') {
-      this.dataAccessor.items = list;
+      this.dataAccessor.weaponsAndArmor = list;
     } else if (listName === 'food') {
       this.dataAccessor.food = list;
     } else if (listName === 'consumables') {
@@ -165,13 +165,13 @@ export class JournalInventoryComponent {
 
   public updateDatabase(listname: string): void {
     if (listname === 'weaponsAndArmor') {
-      this.dataAccessor.items = this.weaponsAndArmor;
+      this.dataAccessor.weaponsAndArmor = this.weaponsAndArmor;
     } else if (listname === 'consumables') {
       this.dataAccessor.consumables = this.consumables;
     } else if (listname === 'miscellaneous') {
       this.dataAccessor.miscellaneous = this.miscellaneous;
     } else {
-      throw new Error('Unknown list name: ' + listname);
+      throw new Error('DND-ERROR: Unknown list name: ' + listname);
     }
   }
 

+ 4 - 0
src/app/journal/journal-routing.module.ts

@@ -13,11 +13,15 @@ import { JournalPlacesComponent } from './journal-places/journal-places.componen
 import { JournalMapsComponent } from './journal-maps/journal-maps.component';
 import { JournalRulesetComponent } from './journal-ruleset/journal-ruleset.component';
 import { JournalSettingsComponent } from './journal-settings/journal-settings.component';
+import { DataResolverService } from 'src/services/dataResolve/data-resolver.service';
 
 const routes: Routes = [
   {
     path: '',
     component: JournalHomeComponent,
+    resolve: {
+      data: DataResolverService,
+    },
     children: [
       { path: 'stats', component: JournalStatsComponent },
       { path: 'character', component: JournalCharacterComponent },

+ 89 - 20
src/app/journal/journal-spellcards/journal-spellcards.component.ts

@@ -67,9 +67,14 @@ export class JournalSpellcardsComponent {
     level: number,
     spellIndex: number
   ): void {
+    const favorites = this.dataAccessor.favoriteSpells;
+    const alreadyInFavorites = favorites.some(
+      (currentSpell) => currentSpell.name === spell.name
+    );
     this.modalAccessor.openModal(FullSpellcardComponent, {
       spell: spell,
       isFromDashboard: false,
+      alreadyInFavorites: alreadyInFavorites,
     });
     const resultSubscription = this.modalAccessor.result$.subscribe(
       (result) => {
@@ -153,12 +158,12 @@ export class JournalSpellcardsComponent {
 
   public addSpell(spell: Spell, level: number) {
     this.getSpellList(level).push(spell);
-    // this.updateSpellsInDatabase();
+    this.updateSpellsInDatabase(level);
   }
 
   public updateSpell(spell: Spell, level: number, index: number): void {
     this.getSpellList(level)![index] = spell;
-    this.updateSpellsInDatabase();
+    this.updateSpellsInDatabase(level);
   }
 
   public getSpellList(level: number): Spell[] {
@@ -227,6 +232,9 @@ export class JournalSpellcardsComponent {
         event.previousIndex,
         event.currentIndex
       );
+      console.warn(event.previousContainer);
+      this.updateSpellsInDatabase(this.getIndex(event.previousContainer.id));
+      // update database with one level
     } else {
       transferArrayItem(
         event.previousContainer.data,
@@ -234,6 +242,7 @@ export class JournalSpellcardsComponent {
         event.previousIndex,
         event.currentIndex
       );
+      this.updateSpellsInDatabase(this.getIndex(event.previousContainer.id));
 
       // Update level of moved spell
       const movedSpell = event.container.data[event.currentIndex];
@@ -242,38 +251,75 @@ export class JournalSpellcardsComponent {
       switch (newContainer) {
         case 'cdk-drop-list-0':
           movedSpell.level = 0;
+          this.updateSpellsInDatabase(0);
           break;
         case 'cdk-drop-list-1':
           movedSpell.level = 1;
+          this.updateSpellsInDatabase(1);
           break;
         case 'cdk-drop-list-2':
           movedSpell.level = 2;
+          this.updateSpellsInDatabase(2);
           break;
         case 'cdk-drop-list-3':
           movedSpell.level = 3;
+          this.updateSpellsInDatabase(3);
           break;
         case 'cdk-drop-list-4':
           movedSpell.level = 4;
+          this.updateSpellsInDatabase(4);
           break;
         case 'cdk-drop-list-5':
           movedSpell.level = 5;
+          this.updateSpellsInDatabase(5);
           break;
         case 'cdk-drop-list-6':
           movedSpell.level = 6;
+          this.updateSpellsInDatabase(6);
           break;
         case 'cdk-drop-list-7':
           movedSpell.level = 7;
+          this.updateSpellsInDatabase(7);
           break;
         case 'cdk-drop-list-8':
           movedSpell.level = 8;
+          this.updateSpellsInDatabase(8);
           break;
         case 'cdk-drop-list-9':
           movedSpell.level = 9;
+          this.updateSpellsInDatabase(9);
           break;
       }
     }
   }
 
+  private getIndex(id: string): number {
+    switch (id) {
+      case 'cdk-drop-list-0':
+        return 0;
+      case 'cdk-drop-list-1':
+        return 1;
+      case 'cdk-drop-list-2':
+        return 2;
+      case 'cdk-drop-list-3':
+        return 3;
+      case 'cdk-drop-list-4':
+        return 4;
+      case 'cdk-drop-list-5':
+        return 5;
+      case 'cdk-drop-list-6':
+        return 6;
+      case 'cdk-drop-list-7':
+        return 7;
+      case 'cdk-drop-list-8':
+        return 8;
+      case 'cdk-drop-list-9':
+        return 9;
+      default:
+        throw new Error('DND-ERROR: Invalid spell level');
+    }
+  }
+
   public dragStart(index: number) {
     this.draggingIndex = index;
   }
@@ -284,6 +330,7 @@ export class JournalSpellcardsComponent {
         event.source.element.nativeElement.id,
         1
       );
+      this.updateSpellsInDatabase(this.draggingIndex!);
     }
     this.draggingIndex = undefined;
   }
@@ -292,13 +339,13 @@ export class JournalSpellcardsComponent {
     this.level0 = this.dataAccessor.spellLevel0;
     this.level1 = this.dataAccessor.spellLevel1;
     this.level2 = this.dataAccessor.spellLevel2;
-    // this.level3 = this.dataAccessor.spellLevel3;
-    // this.level4 = this.dataAccessor.spellLevel4;
-    // this.level5 = this.dataAccessor.spellLevel5;
-    // this.level6 = this.dataAccessor.spellLevel6;
-    // this.level7 = this.dataAccessor.spellLevel7;
-    // this.level8 = this.dataAccessor.spellLevel8;
-    // this.level9 = this.dataAccessor.spellLevel9;
+    this.level3 = this.dataAccessor.spellLevel3;
+    this.level4 = this.dataAccessor.spellLevel4;
+    this.level5 = this.dataAccessor.spellLevel5;
+    this.level6 = this.dataAccessor.spellLevel6;
+    this.level7 = this.dataAccessor.spellLevel7;
+    this.level8 = this.dataAccessor.spellLevel8;
+    this.level9 = this.dataAccessor.spellLevel9;
   }
 
   private hideEmptySpelllists(): void {
@@ -316,16 +363,38 @@ export class JournalSpellcardsComponent {
     ];
   }
 
-  private updateSpellsInDatabase(): void {
-    this.dataAccessor.spellLevel0 = this.level0;
-    this.dataAccessor.spellLevel1 = this.level1;
-    this.dataAccessor.spellLevel2 = this.level2;
-    // this.dataAccessor.spellLevel3 = this.level3;
-    // this.dataAccessor.spellLevel4 = this.level4;
-    // this.dataAccessor.spellLevel5 = this.level5;
-    // this.dataAccessor.spellLevel6 = this.level6;
-    // this.dataAccessor.spellLevel7 = this.level7;
-    // this.dataAccessor.spellLevel8 = this.level8;
-    // this.dataAccessor.spellLevel9 = this.level9;
+  private updateSpellsInDatabase(level: number): void {
+    switch (level) {
+      case 0:
+        this.dataAccessor.spellLevel0 = this.level0;
+        break;
+      case 1:
+        this.dataAccessor.spellLevel1 = this.level1;
+        break;
+      case 2:
+        this.dataAccessor.spellLevel2 = this.level2;
+        break;
+      case 3:
+        this.dataAccessor.spellLevel3 = this.level3;
+        break;
+      case 4:
+        this.dataAccessor.spellLevel4 = this.level4;
+        break;
+      case 5:
+        this.dataAccessor.spellLevel5 = this.level5;
+        break;
+      case 6:
+        this.dataAccessor.spellLevel6 = this.level6;
+        break;
+      case 7:
+        this.dataAccessor.spellLevel7 = this.level7;
+        break;
+      case 8:
+        this.dataAccessor.spellLevel8 = this.level8;
+        break;
+      case 9:
+        this.dataAccessor.spellLevel9 = this.level9;
+        break;
+    }
   }
 }

+ 2 - 2
src/app/journal/journal-stats/ability-panel/ability-table/ability-table.component.ts

@@ -38,7 +38,7 @@ export class AbilityTableComponent {
   ) {}
 
   public ngOnInit(): void {
-    this.abilities = this.dataAccessor.getAbilities();
+    this.abilities = this.dataAccessor.abilities;
   }
 
   public ngAfterViewInit(): void {
@@ -113,7 +113,7 @@ export class AbilityTableComponent {
   }
 
   public updateDatabase(): void {
-    this.dataAccessor.setSAbilities(this.abilities);
+    this.dataAccessor.abilities = this.abilities;
   }
 
   // add

+ 2 - 2
src/app/journal/journal-stats/ability-panel/proficiencies-table/proficiencies-table.component.ts

@@ -19,7 +19,7 @@ export class ProficienciesTableComponent {
     public dataAccessor: DataService,
     public ngxSmartModalService: NgxSmartModalService
   ) {
-    this.proficiencies = this.dataAccessor.getProficiencies();
+    this.proficiencies = this.dataAccessor.proficiencies;
   }
 
   public proficiencies!: any;
@@ -67,7 +67,7 @@ export class ProficienciesTableComponent {
   }
 
   public updateDatabase(): void {
-    this.dataAccessor.setProficiencies(this.proficiencies);
+    this.dataAccessor.proficiencies = this.proficiencies;
   }
 
   public updateProficiencies(data: any): void {

+ 10 - 5
src/app/journal/journal-stats/ability-panel/spellslots/spellslots.component.ts

@@ -20,8 +20,8 @@ export class SpellslotsComponent {
   public slotNumber: number = 1;
 
   public ngOnInit(): void {
-    const spells = this.dataAccessor.getSpellslots();
-    const kiPoints = this.dataAccessor.getKiPoints();
+    const spells = this.dataAccessor.spellslots;
+    const kiPoints = this.dataAccessor.kiPoints;
     this.spellslots = spells.spellslots;
     this.showSpellslots = spells.showSpellslots;
     this.kiPoints = kiPoints;
@@ -97,10 +97,13 @@ export class SpellslotsComponent {
   }
 
   public correctSpellslotsView(levelIndex: number): void {
+    console.log('levelindex: ', levelIndex);
     const totalSlots = this.spellslots[levelIndex].totalSlots;
     const usedSlots = this.spellslots[levelIndex].usedSlots;
     for (let slotIndex = 0; slotIndex < usedSlots; slotIndex++) {
       setTimeout(() => {
+        console.warn('slotIndexTrue: ', slotIndex);
+
         (
           document.getElementById(
             'checkbox' + levelIndex + '-' + slotIndex
@@ -110,6 +113,8 @@ export class SpellslotsComponent {
     }
     for (let slotIndex = usedSlots; slotIndex < totalSlots; slotIndex++) {
       setTimeout(() => {
+        console.warn('slotIndexFalse: ', slotIndex);
+
         (
           document.getElementById(
             'checkbox' + levelIndex + '-' + slotIndex
@@ -130,14 +135,14 @@ export class SpellslotsComponent {
   }
 
   public updateSpellslotDatabase(): void {
-    this.dataAccessor.setSpellslots({
+    this.dataAccessor.spellslots = {
       spellslots: this.spellslots,
       showSpellslots: this.showSpellslots,
-    });
+    };
   }
 
   public updateKiPointsDatabase(): void {
-    this.dataAccessor.setKiPoints(this.kiPoints);
+    this.dataAccessor.kiPoints = this.kiPoints;
   }
 
   public openSpellslotModal(): void {

+ 2 - 2
src/app/journal/journal-stats/ability-panel/trait-table/trait-table.component.ts

@@ -30,7 +30,7 @@ export class TraitTableComponent {
   ) {}
 
   public ngOnInit(): void {
-    this.traits = this.dataAccessor.getTraits();
+    this.traits = this.dataAccessor.traits;
   }
 
   public drop(event: CdkDragDrop<string[]>): void {
@@ -61,7 +61,7 @@ export class TraitTableComponent {
   }
 
   public updateDatabase(): void {
-    this.dataAccessor.setTraits(this.traits);
+    this.dataAccessor.traits = this.traits;
   }
 
   private resetUpdateData(): void {

+ 1 - 1
src/app/journal/journal-stats/attribute-skill-container/attribute-panel/attribute-field/attribute-field.component.html

@@ -5,7 +5,7 @@
   <div class="attribute-modifier">{{ attributeModifier }}</div>
   <div>
     <input
-      class="attribute-value"
+      type="number"
       [(ngModel)]="attribute.value"
       (change)="updateValue()"
       (click)="$event.stopPropagation()"

+ 14 - 6
src/app/journal/journal-stats/attribute-skill-container/attribute-panel/attribute-field/attribute-field.component.scss

@@ -1,4 +1,4 @@
-.attribute-box{
+.attribute-box {
     border: solid 1px var(--border-color);
     background-color: var(--field-background-color);
     box-shadow: var(--shadow-small);
@@ -6,12 +6,12 @@
     text-align: center;
     cursor: pointer;
 
-    .attribute-name{
+    .attribute-name {
         cursor: pointer;
         font-weight: 600;
     }
 
-    input{
+    input {
         border: none;
         outline: none;
         box-shadow: none;
@@ -22,10 +22,18 @@
         font-weight: 600;
     }
 
-    .attribute-modifier{
+    input[type="number"]::-webkit-inner-spin-button,
+    input[type="number"]::-webkit-outer-spin-button {
+        -webkit-appearance: none;
+        margin: 0;
+    }
+
+    input[type="number"] {
+        -moz-appearance: textfield;
+    }
+
+    .attribute-modifier {
         font-size: 2rem;
         font-weight: 700;
     }
 }
-
-        

+ 0 - 20
src/app/journal/journal-stats/attribute-skill-container/attribute-panel/attribute-field/attribute-field.component.ts

@@ -42,14 +42,6 @@ export class AttributeFieldComponent {
     observable.subscribe((newValue: Attribute) => {
       this.attribute = newValue;
       this.attributeModifier = this.calculateModifier();
-      this.saveModifier = this.calculateSaveModifier();
-    });
-  }
-
-  private initProficiencySubscription(): void {
-    this.dataAccessor.proficiency$.subscribe((newValue: any) => {
-      this.proficiencyBonus = newValue.value;
-      this.saveModifier = this.calculateSaveModifier();
     });
   }
 
@@ -70,18 +62,6 @@ export class AttributeFieldComponent {
     }
   }
 
-  public calculateSaveModifier(): string {
-    let mod: number = Math.floor((this.attribute.value - 10) / 2);
-    if (this.attribute.proficiency) {
-      mod += this.proficiencyBonus;
-    }
-    if (mod > 0) {
-      return '+' + mod;
-    } else {
-      return mod.toString();
-    }
-  }
-
   public openDetails(): void {
     console.log(this.attribute);
     this.detailsAccessor.openPanel(AttributeDetailsComponent, {

+ 4 - 1
src/app/journal/journal-stats/attribute-skill-container/save-throw-panel/save-throw-field/save-throw-field.component.html

@@ -3,10 +3,13 @@
     class="save-throw-field__input"
     type="checkbox"
     [(ngModel)]="attribute.proficiency"
-    (click)="$event.stopPropagation()"
+    (click)="updateAttribute(); $event.stopPropagation()"
   />
+  <div>{{ attribute.proficiency }}></div>
 
   <div class="save-throw-field__name">{{ nameTranslator[attributeName] }}</div>
 
   <div class="save-throw-field__value">{{ saveModifier }}</div>
 </div>
+
+<!-- updateAttribute(); -->

+ 19 - 3
src/app/journal/journal-stats/attribute-skill-container/save-throw-panel/save-throw-field/save-throw-field.component.ts

@@ -17,10 +17,9 @@ export class SaveThrowFieldComponent {
   ) {}
 
   @Input() attributeName: string = '';
-
   public attribute: Attribute = { name: '', value: 0, proficiency: false };
 
-  private proficiencyBonus: number = 0;
+  private proficiencyBonus: number = 2;
   private attributeModifier: number = 0;
   public saveModifier: string = '0';
 
@@ -36,6 +35,11 @@ export class SaveThrowFieldComponent {
   public ngOnInit(): void {
     this.initAttributeSubscription();
     this.initProficiencySubscription();
+    // if (this.attributeName === 'charisma') {
+    //   setInterval(() => {
+    //     console.log('current attritube: ', this.attribute);
+    //   }, 1000);
+    // }
   }
 
   private initAttributeSubscription(): void {
@@ -43,6 +47,7 @@ export class SaveThrowFieldComponent {
       `this.dataAccessor.${this.attributeName}$`
     );
     observable.subscribe((newValue: Attribute) => {
+      // console.log('new value: ', newValue);
       this.attribute = newValue;
       this.attributeModifier = this.calculateAttributeModifier();
       this.saveModifier = this.calculateSaveModifier();
@@ -51,7 +56,7 @@ export class SaveThrowFieldComponent {
 
   private initProficiencySubscription(): void {
     this.dataAccessor.proficiency$.subscribe((newValue: any) => {
-      this.proficiencyBonus = newValue.value;
+      this.proficiencyBonus = newValue;
       this.attributeModifier = this.calculateAttributeModifier();
       this.saveModifier = this.calculateSaveModifier();
     });
@@ -79,4 +84,15 @@ export class SaveThrowFieldComponent {
       saveModifier: this.saveModifier,
     });
   }
+
+  public updateAttribute(): void {
+    this.dataAccessor.updateAttribute(this.attribute);
+  }
+
+  // log(): void {
+  //   // console.log('current attritube: ', this.attributeProficiency);
+  //   // this.dataAccessor.updateAttribute(this.attribute);
+  //   // this.attributeProficiency = !this.attributeProficiency;
+  //   this.calculateSaveModifier();
+  // }
 }

+ 9 - 9
src/app/journal/journal-stats/attribute-skill-container/skill-panel/skill-field/skill-field.component.ts

@@ -29,24 +29,24 @@ export class SkillFieldComponent {
     animalHandling: { skill: 'Tierkunde', attribute: 'WIS', long: 'wisdom' },
     arcana: { skill: 'Arkana', attribute: 'INT', long: 'intelligence' },
     athletics: { skill: 'Athletik', attribute: 'STR', long: 'strength' },
-    deception: { skill: 'Täuschung', attribute: 'CHA', long: 'charisma' },
+    deception: { skill: 'Täuschen', attribute: 'CHA', long: 'charisma' },
     history: { skill: 'Geschichte', attribute: 'INT', long: 'intelligence' },
-    insight: { skill: 'Einsicht', attribute: 'WIS', long: 'wisdom' },
+    insight: { skill: 'Motiv erkennen', attribute: 'WIS', long: 'wisdom' },
     intimidation: {
       skill: 'Einschüchtern',
       attribute: 'CHA',
       long: 'charisma',
     },
     investigation: {
-      skill: 'Ermittlung',
+      skill: 'Nachforschung',
       attribute: 'INT',
       long: 'intelligence',
     },
-    medicine: { skill: 'Medizin', attribute: 'WIS', long: 'wisdom' },
-    nature: { skill: 'Natur', attribute: 'INT', long: 'intelligence' },
+    medicine: { skill: 'Heilkunde', attribute: 'WIS', long: 'wisdom' },
+    nature: { skill: 'Naturkunde', attribute: 'INT', long: 'intelligence' },
     perception: { skill: 'Wahrnehmung', attribute: 'WIS', long: 'wisdom' },
-    performance: { skill: 'Performance', attribute: 'CHA', long: 'charisma' },
-    persuasion: { skill: 'Überredung', attribute: 'CHA', long: 'charisma' },
+    performance: { skill: 'Auftreten', attribute: 'CHA', long: 'charisma' },
+    persuasion: { skill: 'Überzeugen', attribute: 'CHA', long: 'charisma' },
     religion: { skill: 'Religion', attribute: 'INT', long: 'intelligence' },
     sleightOfHand: {
       skill: 'Fingerfertigkeit',
@@ -54,7 +54,7 @@ export class SkillFieldComponent {
       long: 'dexterity',
     },
     stealth: { skill: 'Heimlichkeit', attribute: 'GES', long: 'dexterity' },
-    survival: { skill: 'Überleben', attribute: 'WIS', long: 'wisdom' },
+    survival: { skill: 'Überlebenskunst', attribute: 'WIS', long: 'wisdom' },
   };
 
   ngOnInit(): void {
@@ -86,7 +86,7 @@ export class SkillFieldComponent {
 
   private initProficiencySubscription(): void {
     this.dataAccessor.proficiency$.subscribe((newValue: any) => {
-      this.proficiencyBonus = newValue.value;
+      this.proficiencyBonus = newValue;
       this.skillModifier = this.calculateModifier();
     });
   }

+ 9 - 9
src/app/journal/journal-stats/attribute-skill-container/skill-panel/skill-panel.component.ts

@@ -8,22 +8,22 @@ import { Component } from '@angular/core';
 export class SkillPanelComponent {
   public skills: any = [
     'acrobatics',
-    'animalHandling',
     'arcana',
     'athletics',
-    'deception',
+    'performance',
+    'intimidation',
+    'sleightOfHand',
     'history',
+    'medicine',
+    'stealth',
+    'animalHandling',
     'insight',
-    'intimidation',
     'investigation',
-    'medicine',
     'nature',
-    'perception',
-    'performance',
-    'persuasion',
     'religion',
-    'sleightOfHand',
-    'stealth',
+    'deception',
     'survival',
+    'persuasion',
+    'perception',
   ];
 }

+ 1 - 0
src/app/journal/journal-stats/info-row/conditions/conditions.component.html

@@ -21,6 +21,7 @@
       style="width: 6rem"
       [(ngModel)]="exhaustion"
       (change)="updateExhaustion()"
+      (click)="$event.stopPropagation()"
     />
     <div class="info-label">Erschöpfung</div>
   </div>

+ 2 - 1
src/app/journal/journal-stats/info-row/conditions/conditions.component.ts

@@ -16,7 +16,7 @@ export class ConditionsComponent {
   ) {}
 
   public exhaustion: number = 0;
-  public conditions: string[] = ['Blind', 'Kampfunfähig'];
+  public conditions: string[] = [];
 
   public availableConditions: string[] = [
     'Betäubt',
@@ -57,6 +57,7 @@ export class ConditionsComponent {
         console.log(result);
         if (result.state === 'update') {
           this.conditions = result.data;
+          this.dataAccessor.conditions = this.conditions;
         }
         resultSubscription.unsubscribe();
       }

+ 2 - 5
src/app/journal/journal-stats/info-row/proficiency/proficiency-field.component.ts

@@ -22,15 +22,12 @@ export class ProficiencyFieldComponent {
 
   private initAttributeSubscription(): void {
     this.dataAccessor.proficiency$.subscribe((newValue: any) => {
-      this.proficiency = newValue.value;
+      this.proficiency = newValue;
     });
   }
 
   public updateValue(): void {
-    this.dataAccessor.updateCharacterData({
-      name: 'proficiency',
-      value: this.proficiency,
-    });
+    this.dataAccessor.updateProficiencyBonus(this.proficiency);
   }
 
   public openDetails(): void {

+ 1 - 0
src/app/journal/journal-stats/life-container/life/life.component.html

@@ -1,5 +1,6 @@
 <div class="life-box">
   <div class="life-box-name" (click)="openDetailsPanel()">Trefferpunkte</div>
+  <div>{{ name }}</div>
   <div class="life-box-bar" (click)="openDetailsPanel()">
     <!-- FIXME: The percentages are not shown correctly when using the details panel -->
     <div

+ 7 - 4
src/app/journal/journal-stats/life-container/life/life.component.ts

@@ -22,12 +22,15 @@ export class LifeComponent {
   public temporaryHitPointsPercentage: number = 0;
   public missingHitPointsPercentage: number = 0;
 
+  public name: string = '';
+
   ngOnInit(): void {
-    const lifeData = this.dataAccessor.hitPoints;
-    this.maxHitPoints = lifeData.maxHitPoints;
-    this.currentHitPoints = lifeData.currentHitPoints;
-    this.temporaryHitPoints = lifeData.temporaryHitPoints;
+    const hitPointsData = this.dataAccessor.hitPoints;
+    this.maxHitPoints = hitPointsData.maxHitPoints;
+    this.currentHitPoints = hitPointsData.currentHitPoints;
+    this.temporaryHitPoints = hitPointsData.temporaryHitPoints;
     this.calculatePercentages();
+    this.name = this.dataAccessor.characterName;
   }
 
   public addHitPoints(): void {

+ 1 - 1
src/app/journal/journal-stats/weapons-container/spell-table/spell-table.component.ts

@@ -181,7 +181,7 @@ export class SpellTableComponent {
     this.spellcastingAttribute = 'intelligence';
 
     this.dataAccessor.proficiency$.subscribe((value) => {
-      this.proficiencyBonus = value.value;
+      this.proficiencyBonus = value;
       if (this.spellcastingAttribute) {
         this.computeSpellAttackBonusAndSaveDC();
       }

+ 2 - 2
src/app/journal/journal-stats/weapons-container/weapon-table/weapon-table.component.ts

@@ -56,7 +56,7 @@ export class WeaponTableComponent {
         this.calculateDamageModifierArray();
       }
     });
-    this.weapons = this.dataAccessor.getWeapons();
+    this.weapons = this.dataAccessor.favoriteWeapons;
     this.calculateDamageModifierArray();
   }
 
@@ -98,7 +98,7 @@ export class WeaponTableComponent {
   }
 
   public updateWeaponInDatabase(): void {
-    this.dataAccessor.setWeapons(this.weapons);
+    this.dataAccessor.favoriteWeapons = this.weapons;
   }
 
   public addWeapon(weapon: Weapon) {

+ 6 - 2
src/app/shared-components/full-spellcard/full-spellcard.component.html

@@ -109,8 +109,12 @@
 
   <div class="delete-row">
     @if(!isFromDashboard){
-    <button class="add-button" (click)="addToFavorites()">
-      Zu Favoriten hinzufügen
+    <button
+      [class]="alreadyInFavorites ? 'disabled add-button' : 'add-button'"
+      (click)="alreadyInFavorites ? '' : addToFavorites()"
+    >
+      @if(alreadyInFavorites){ Bereits in Favoriten} @else{ Zu Favoriten
+      hinzufügen }
     </button>
     <button class="edit-button" (click)="update()">Anpassen</button>
     <button class="delete-button" (click)="delete()">Löschen</button>

+ 9 - 0
src/app/shared-components/full-spellcard/full-spellcard.component.scss

@@ -50,4 +50,13 @@
         background: var(--accept-hover);
         scale: 1.03;
     }
+
+    &.disabled {
+        filter: grayscale(50%);
+        &:hover {
+            scale: 1;
+            background: var(--accept);
+            cursor: default;
+        }
+    }
 }

+ 1 - 0
src/app/shared-components/full-spellcard/full-spellcard.component.ts

@@ -10,6 +10,7 @@ import { ModalService } from 'src/services/modal/modal.service';
 export class FullSpellcardComponent {
   @Input() public spell!: Spell;
   @Input() public isFromDashboard!: boolean;
+  @Input() public alreadyInFavorites!: boolean;
 
   public constructor(private modalAccessor: ModalService) {}
 

+ 307 - 586
src/services/data/data.service.ts

@@ -1,6 +1,5 @@
 import { Injectable } from '@angular/core';
 import Localbase from 'localbase';
-import { Character } from 'src/interfaces/character';
 import { Router } from '@angular/router';
 import { BehaviorSubject } from 'rxjs';
 import { Attribute } from 'src/interfaces/attribute';
@@ -16,195 +15,130 @@ import { Food } from 'src/interfaces/food';
   providedIn: 'root',
 })
 export class DataService {
-  db: any;
+  private db: any;
+
+  public dataLoaded = false;
+  public characterName: string = '';
 
   constructor(private Router: Router) {
-    this.db = new Localbase('myDatabase');
-    // this.test();
-  }
-
-  // public test(): void {
-  //   let char: Character = {
-  //     characterData: {
-  //       name: 'Eliane',
-  //       class: '',
-  //       race: '',
-  //       level: '',
-  //       subclass: '',
-  //       background: '',
-  //       experience: '',
-  //       inspiration: '',
-  //       proficiencyBonus: '2',
-  //     },
-  //     attributes: {
-  //       strength: ['12', false],
-  //       dexterity: ['14', false],
-  //       constitution: ['16', false],
-  //       intelligence: ['10', false],
-  //       wisdom: ['16', false],
-  //       charisma: ['10', false],
-  //     },
-  //     skills: {
-  //       acrobatics: ['12', false],
-  //       animalHandling: ['11', false],
-  //       arcana: ['11', false],
-  //       athletics: ['11', false],
-  //       deception: ['11', false],
-  //       history: ['12', false],
-  //       insight: ['13', false],
-  //       intimidation: ['14', false],
-  //       investigation: ['16', false],
-  //       medicine: ['15', false],
-  //       nature: ['17', false],
-  //       perception: ['18', false],
-  //       performance: ['19', false],
-  //       persuasion: ['20', false],
-  //       religion: ['9', false],
-  //       sleightOfHand: ['8', false],
-  //       stealth: ['7', false],
-  //       survival: ['6', false],
-  //     },
-  //     combatStats: {
-  //       armorClass: '18',
-  //       initiative: '+2',
-  //       speed: '30',
-  //       hitPointMaximum: '12',
-  //       currentHitPoints: '12',
-  //       temporaryHitPoints: '0',
-  //       hitDice: '',
-  //       deathSaveSuccesses: '0',
-  //       deathSaveFailures: '0',
-  //     },
-  //     appearance: {
-  //       age: '',
-  //       height: '',
-  //       weight: '',
-  //       eyes: '',
-  //       skin: '',
-  //       hair: '',
-  //     },
-  //     personality: {
-  //       personalityTraits: '',
-  //       ideals: '',
-  //       bonds: '',
-  //       flaws: '',
-  //     },
-  //     weapons: {
-  //       name: '',
-  //       attackBonus: '',
-  //       damage: '',
-  //       damageType: '',
-  //       range: '',
-  //       description: '',
-  //     },
-  //   };
-  //   this.character = char;
-  //   // console.log('character: ', this.character);
-  // }
-
-  public character: any = {};
-
-  // #region character data retrieval
-
-  public getCompleteCharacter(): Character {
-    return this.character;
-  }
-
-  public getCharacterData(): any {
-    return this.character.characterData;
-  }
-
-  public getAppearance(): any {
-    return this.character.appearance;
-  }
-
-  public getAttributes(): any {
-    return this.character.attributes;
-  }
-
-  public getSkills(): any {
-    return this.character.skills;
-  }
-
-  public getCombatStats(): any {
-    return this.character.combatStats;
-  }
-
-  public getPersonality(): any {
-    return this.character.personality;
-  }
-
-  // public getWeapons(): any {
-  //   return this.character.weapons;
-  // }
+    this.db = new Localbase('DNDTools');
+    // this.db.config.debug = false;
+  }
 
-  // #endregion
+  async loadData(): Promise<any> {
+    console.warn('loadData() called');
+    this.characterName = sessionStorage.getItem('characterName')!;
+    if (this.dataLoaded) {
+      return Promise.resolve();
+    }
+    return this.getCollectionWithKeys(this.characterName).then((data: any) => {
+      this.buildCurrentCharacter(data);
+      this.dataLoaded = true;
+    });
+  }
 
-  // #region data storage
+  // #region character selection and construction
 
-  private weapons: Weapon[] = [
-    {
-      name: 'Großschwert',
-      attackBonus: '+3',
-      damage: [{ diceNumber: '2', diceType: 'd6', damageType: 'slashing' }],
-      proficient: true,
-      range: '5ft',
-      throwRange: '',
-      isFinesse: false,
-      isVersatile: false,
-      isTwoHanded: true,
-      isRanged: false,
-      canBeThrown: false,
-      weight: 'schwer',
-      isMagical: false,
-    },
-    {
-      name: 'Kurzbogen +1',
-      attackBonus: '+5',
-      damage: [{ diceNumber: '1', diceType: 'd8', damageType: 'piercing' }],
-      proficient: false,
-      range: '80/320ft',
-      throwRange: '',
-      isFinesse: false,
-      isVersatile: false,
-      isTwoHanded: true,
-      isRanged: true,
-      canBeThrown: false,
-      weight: 'leicht',
-      isMagical: true,
-      magicBonus: 1,
-    },
-    {
-      name: 'Feuerstab',
-      attackBonus: '+5',
-      damage: [
-        { diceNumber: '1', diceType: 'd6', damageType: 'bludgeoning' },
-        { diceNumber: '1', diceType: 'd4', damageType: 'fire' },
-      ],
-      versatileDamage: 'd8',
-      proficient: true,
-      range: '5ft',
-      throwRange: '',
-      isFinesse: false,
-      isVersatile: true,
-      isTwoHanded: false,
-      isRanged: false,
-      canBeThrown: false,
-      weight: 'normal',
-      isMagical: false,
-    },
-  ];
+  private buildCurrentCharacter(currentCharacterData: any): void {
+    console.log('currentCharacterData: ', currentCharacterData);
+    const [
+      abilitiesData,
+      appearanceData,
+      attributesData,
+      characterData,
+      combatStatsData,
+      consumablesData,
+      favoriteSpellsData,
+      favoriteWeaponsData,
+      foodData,
+      hitPointsData,
+      kiPointsData,
+      miscellaneousData,
+      moneyData,
+      personalityData,
+      proficienciesData,
+      skillsData,
+      spellLevel0,
+      spellLevel1,
+      spellLevel2,
+      spellLevel3,
+      spellLevel4,
+      spellLevel5,
+      spellLevel6,
+      spellLevel7,
+      spellLevel8,
+      spellLevel9,
+      spellslotsData,
+      traitsData,
+      weaponsAndArmorData,
+    ] = currentCharacterData.map((entry: any) => entry.data);
 
-  public getWeapons(): Weapon[] {
-    return this.weapons;
+    // currentCharacterData.forEach((entry: any, index: number) => {
+    //   console.log(entry.key, ' : ', entry.data);
+    // });
+
+    console.warn('The whole character: ', currentCharacterData);
+
+    // Attributes
+    Object.keys(attributesData).forEach((key: string) => {
+      this.updateAttribute(attributesData[key]);
+    });
+
+    //  Skills
+    Object.keys(skillsData).forEach((key: string) => {
+      this.updateSkill(skillsData[key]);
+    });
+
+    // Hit Points
+    this.hitPoints = hitPointsData.hitPoints;
+    this.hitDice = hitPointsData.hitDice;
+
+    // Combat Stats
+    this.armorClass = combatStatsData.armorClass;
+    this.initiative = combatStatsData.initiative;
+    this.movement = combatStatsData.movement;
+    this.updateProficiencyBonus(combatStatsData.proficiencyBonus);
+    this.deathSaves = combatStatsData.deathSaves;
+    this.conditions = combatStatsData.conditions;
+    this.exhaustion = combatStatsData.exhaustion;
+    this.inspiration = combatStatsData.inspiration;
+
+    // Spells
+    this.spellslots = spellslotsData;
+    this.favoriteSpells = favoriteSpellsData.spells;
+    this.spellLevel0 = spellLevel0.spells;
+    this.spellLevel1 = spellLevel1.spells;
+    this.spellLevel2 = spellLevel2.spells;
+    this.spellLevel3 = spellLevel3.spells;
+    this.spellLevel4 = spellLevel4.spells;
+    this.spellLevel5 = spellLevel5.spells;
+    this.spellLevel6 = spellLevel6.spells;
+    this.spellLevel7 = spellLevel7.spells;
+    this.spellLevel8 = spellLevel8.spells;
+    this.spellLevel9 = spellLevel9.spells;
+
+    // Items
+    this.favoriteWeapons = favoriteWeaponsData.data;
+    this.weaponsAndArmor = weaponsAndArmorData.data;
+    this.consumables = consumablesData.data;
+    this.miscellaneous = miscellaneousData.data;
+    this.food = foodData.data;
+    this.money = moneyData;
+
+    // Abilities and stuff
+    this.kiPoints = kiPointsData;
+    this.traits = traitsData.data;
+    this.abilities = abilitiesData.data;
+    this.proficiencies = proficienciesData;
   }
 
-  public setWeapons(weapons: Weapon[]): void {
-    this.weapons = weapons;
-    console.log('weapons updated from data service: ', this.weapons);
-  }
+  // #endregion
+
+  // #region WEAPONS
+
+  // #endregion
 
-  // SPELLS
+  // #region # SPELLS
 
   private _favoriteSpells: Spell[] = [
     {
@@ -315,7 +249,7 @@ export class DataService {
 
   public set favoriteSpells(spells: Spell[]) {
     this._favoriteSpells = spells;
-    console.log('spells updated from data service: ', this._favoriteSpells);
+    this.setData('favoriteSpells', { spells: spells });
   }
 
   private _spellLevel0: Spell[] = [
@@ -400,7 +334,7 @@ export class DataService {
 
   public set spellLevel0(spells: Spell[]) {
     this._spellLevel0 = spells;
-    console.log('spells updated from data service: ', this._spellLevel0);
+    this.setData('spellLevel0', { spells: spells });
   }
 
   private _spellLevel1: Spell[] = [
@@ -460,7 +394,7 @@ export class DataService {
 
   public set spellLevel1(spells: Spell[]) {
     this._spellLevel1 = spells;
-    console.log('spells updated from data service: ', this._spellLevel1);
+    this.setData('spellLevel1', { spells: spells });
   }
 
   private _spellLevel2: Spell[] = [
@@ -524,7 +458,7 @@ export class DataService {
 
   public set spellLevel2(spells: Spell[]) {
     this._spellLevel2 = spells;
-    console.log('spells updated from data service: ', this._spellLevel2);
+    this.setData('spellLevel2', { spells: spells });
   }
 
   private _spellLevel3: Spell[] = [];
@@ -535,7 +469,7 @@ export class DataService {
 
   public set spellLevel3(spells: Spell[]) {
     this._spellLevel3 = spells;
-    console.log('spells updated from data service: ', this._spellLevel3);
+    this.setData('spellLevel3', { spells: spells });
   }
 
   private _spellLevel4: Spell[] = [];
@@ -546,7 +480,7 @@ export class DataService {
 
   public set spellLevel4(spells: Spell[]) {
     this._spellLevel4 = spells;
-    console.log('spells updated from data service: ', this._spellLevel4);
+    this.setData('spellLevel4', { spells: spells });
   }
 
   private _spellLevel5: Spell[] = [];
@@ -557,7 +491,7 @@ export class DataService {
 
   public set spellLevel5(spells: Spell[]) {
     this._spellLevel5 = spells;
-    console.log('spells updated from data service: ', this._spellLevel5);
+    this.setData('spellLevel5', { spells: spells });
   }
 
   private _spellLevel6: Spell[] = [];
@@ -568,7 +502,7 @@ export class DataService {
 
   public set spellLevel6(spells: Spell[]) {
     this._spellLevel6 = spells;
-    console.log('spells updated from data service: ', this._spellLevel6);
+    this.setData('spellLevel6', { spells: spells });
   }
 
   private _spellLevel7: Spell[] = [];
@@ -579,7 +513,7 @@ export class DataService {
 
   public set spellLevel7(spells: Spell[]) {
     this._spellLevel7 = spells;
-    console.log('spells updated from data service: ', this._spellLevel7);
+    this.setData('spellLevel7', { spells: spells });
   }
 
   private _spellLevel8: Spell[] = [];
@@ -590,7 +524,7 @@ export class DataService {
 
   public set spellLevel8(spells: Spell[]) {
     this._spellLevel8 = spells;
-    console.log('spells updated from data service: ', this._spellLevel8);
+    this.setData('spellLevel8', { spells: spells });
   }
 
   private _spellLevel9: Spell[] = [];
@@ -601,7 +535,7 @@ export class DataService {
 
   public set spellLevel9(spells: Spell[]) {
     this._spellLevel9 = spells;
-    console.log('spells updated from data service: ', this._spellLevel9);
+    this.setData('spellLevel9', { spells: spells });
   }
 
   public getAllPreparedSpells(): Spell[] {
@@ -619,197 +553,104 @@ export class DataService {
     ];
   }
 
-  //
+  // #endregion
 
-  private abilities: Ability[] = [
-    {
-      name: 'Feenschritt',
-      charges: 8,
-      currentlyUsedCharges: 4,
-      cost: 'bonus',
-      shortDescription:
-        'Als Bonusaktion kannst du dich bis zu 30 Fuß zu einem Punkt teleportieren, den du sehen kannst.',
-      longDescription:
-        'Als Bonusaktion kannst du dich auf magische Weise bis zu 30 Fuß weit in einen unbesetzten Raum teleportieren, den du sehen kannst. Du kannst diese Eigenschaft so oft einsetzen, wie es deinem Fertigkeitsbonus entspricht, und du erhältst alle verbrauchten Einsätze zurück, wenn du eine lange Pause machst.',
-    },
-    {
-      name: 'Durchschnaufen',
-      charges: 1,
-      currentlyUsedCharges: 0,
-      cost: 'bonus',
-      shortDescription:
-        'Als Bonusaktion kannst du dich um 1 d10 + Fighter Level Trefferpunkten heilen.',
-      longDescription:
-        'Als Bonusaktion kannst du dich um 1 d10 + Fighter Level Trefferpunkten heilen. Du kannst diese Fähigkeit einmal pro langer Rast einsetzen.',
-    },
-    {
-      name: 'Tatendrang',
-      charges: 1,
-      currentlyUsedCharges: 1,
-      cost: 'none',
-      shortDescription: 'Du kannst eine weitere Aktion ausführen.',
-      longDescription:
-        'Du kannst eine weitere Aktion ausführen. Du kannst diese Fähigkeit einmal pro langer Rast einsetzen.',
-    },
-  ];
+  // #region ABILITIES
 
-  public getAbilities(): Ability[] {
-    return this.abilities;
+  private _abilities: Ability[] = [];
+
+  public get abilities(): Ability[] {
+    return this._abilities;
   }
 
-  public setSAbilities(abilities: Ability[]): void {
-    this.abilities = abilities;
-    console.log('abilities updated from data service: ', this.abilities);
+  public set abilities(abilities: Ability[]) {
+    this._abilities = abilities;
+    console.warn('abilities: ', abilities);
   }
 
-  private traits: Trait[] = [
-    {
-      name: 'Feenblut',
-      shortDescription:
-        'Du hast Vorteil auf alle Rettungswürfe gegen Zauber und andere magische Effekte.',
-      longDescription:
-        'Du hast Vorteil auf alle Rettungswürfe gegen Zauber und andere magische Effekte.',
-      origin: 'Elf',
-    },
-    {
-      name: 'Dunkelsicht',
-      shortDescription: 'Du hast 60 ft. Dunkelsicht.',
-      longDescription:
-        'Du hast 60 ft. Dunkelsicht. Du kannst in völliger Dunkelheit so klar sehen wie am Tag.',
-      origin: 'Elf',
-    },
-    {
-      name: 'Fey Ancestry',
-      shortDescription:
-        'Du meditierst und musst nicht schlafen. Du kannst nicht durch Magie in Schlaf versetzt werden.',
-      longDescription:
-        'Du meditierst und musst nicht schlafen. Du kannst nicht durch Magie in Schlaf versetzt werden.',
-      origin: 'Elf',
-    },
-  ];
+  private _traits: Trait[] = [];
 
-  public getTraits(): Trait[] {
-    return this.traits;
+  public get traits(): Trait[] {
+    return this._traits;
   }
 
-  public setTraits(traits: Trait[]): void {
-    this.traits = traits;
-    console.log('traits updated from data service: ', this.traits);
+  public set traits(traits: Trait[]) {
+    this._traits = traits;
+    this.setData('traits', { data: traits });
   }
 
-  private spellslots: any = {
-    spellslots: [
-      { totalSlots: 4, usedSlots: 2 },
-      { totalSlots: 2, usedSlots: 1 },
-    ],
+  private _spellslots: any = {
+    spellslots: [],
     showSpellslots: true,
   };
 
-  public getSpellslots(): any {
-    return this.spellslots;
+  public get spellslots(): any {
+    return this._spellslots;
   }
 
-  public setSpellslots(spellslots: any): void {
-    this.spellslots = spellslots;
-    console.log('spellslots updated from data service: ', this.spellslots);
+  public set spellslots(spellslots: any) {
+    this._spellslots = spellslots;
+    this.setData('spellslots', spellslots);
   }
 
-  private kiPoints: any = {
+  private _kiPoints: any = {
     totalPoints: 4,
     usedPoints: 2,
-    showKiPoints: true,
+    showKiPoints: false,
   };
 
-  public getKiPoints(): any {
-    return this.kiPoints;
+  public get kiPoints(): any {
+    return this._kiPoints;
   }
 
-  public setKiPoints(kiPoints: any): void {
-    this.kiPoints = kiPoints;
-    console.log('kiPoints updated from data service: ', this.kiPoints);
+  public set kiPoints(kiPoints: any) {
+    this._kiPoints = kiPoints;
+    this.setData('kiPoints', kiPoints);
   }
 
-  private proficiencies: any = {
-    armor: {
-      light: true,
-      medium: true,
-      heavy: false,
-    },
-    weapons: {
-      simple: true,
-      martial: true,
-      other: ['Kurzschwert', 'Gleve'],
-    },
-    tools: ['Schmiedewerkzeuge', 'Würfel'],
-    languages: ['Gemeinsprache', 'Elfisch', 'Zwergisch'],
-  };
+  private _proficiencies: any = {};
 
-  public getProficiencies(): any {
-    return this.proficiencies;
+  public get proficiencies(): any {
+    return this._proficiencies;
   }
 
-  public setProficiencies(proficiencies: any): void {
-    this.proficiencies = proficiencies;
-    console.log(
-      'proficiencies updated from data service: ',
-      this.proficiencies
-    );
+  public set proficiencies(proficiencies: any) {
+    this._proficiencies = proficiencies;
+    this.setData('proficiencies', proficiencies);
   }
 
-  // #region Character Data observables
+  // #endregion
 
-  /**
-   *
-   * @param newValue The new value of the Character Data
-   */
-  public updateCharacterData(newValue: any) {
-    const functionCall: string = newValue.name + 'Subject.next(newValue)';
-    eval(`this.${functionCall}`);
-    console.log('updateProperty: ', newValue.value);
-    // TODO: Datenbank updaten
-  }
+  // #region # COMBAT STATS
 
-  private proficiencySubject = new BehaviorSubject<any>({
-    name: 'proficiencyBonus',
-    value: 2,
-  });
+  private proficiencySubject = new BehaviorSubject<number>(2);
   public proficiency$ = this.proficiencySubject.asObservable();
 
-  private _hitPoints = {
-    maxHitPoints: 10,
-    currentHitPoints: 8,
-    temporaryHitPoints: 1,
-  };
-
-  public set hitPoints(hitPointsData: any) {
-    console.log('hitPointsData: ', hitPointsData);
-    this._hitPoints = hitPointsData;
-  }
-
-  public get hitPoints(): any {
-    return this._hitPoints;
+  public updateProficiencyBonus(newValue: number) {
+    this.proficiencySubject.next(newValue);
+    this.writeCombatStatsToDatabase();
   }
 
-  private _armorClass: number = 19;
+  private _armorClass: number = 10;
 
   public get armorClass(): number {
     return this._armorClass;
   }
 
   public set armorClass(newValue: number) {
-    console.log('armorClass: ', newValue);
     this._armorClass = newValue;
+    this.writeCombatStatsToDatabase();
   }
 
-  private _initiative: number = 2;
+  private _initiative: number = 0;
 
   public get initiative(): number {
     return this._initiative;
   }
 
   public set initiative(newValue: number) {
-    console.log('initiative: ', newValue);
     this._initiative = newValue;
+    this.writeCombatStatsToDatabase();
   }
 
   private _movement: number = 30;
@@ -819,19 +660,8 @@ export class DataService {
   }
 
   public set movement(newValue: number) {
-    console.log('movement: ', newValue);
     this._movement = newValue;
-  }
-
-  private _hitDice: any[] = [{ diceNumber: '1', diceType: 'd10' }];
-
-  public get hitDice(): any[] {
-    return this._hitDice;
-  }
-
-  public set hitDice(newValue: any[]) {
-    console.log('hitDice: ', newValue);
-    this._hitDice = newValue;
+    this.writeCombatStatsToDatabase();
   }
 
   private _deathSaves: number[] = [0, 0];
@@ -841,8 +671,8 @@ export class DataService {
   }
 
   public set deathSaves(newValue: number[]) {
-    console.log('deathSaves: ', newValue);
     this._deathSaves = newValue;
+    this.writeCombatStatsToDatabase();
   }
 
   private _inspiration: boolean = false;
@@ -852,8 +682,8 @@ export class DataService {
   }
 
   public set inspiration(newValue: boolean) {
-    console.log('inspiration: ', newValue);
     this._inspiration = newValue;
+    this.writeCombatStatsToDatabase();
   }
 
   private _experience: number = 0;
@@ -863,8 +693,8 @@ export class DataService {
   }
 
   public set experience(newValue: number) {
-    console.log('experience: ', newValue);
     this._experience = newValue;
+    this.writeCombatStatsToDatabase();
   }
 
   private _exhaustion: number = 0;
@@ -874,77 +704,154 @@ export class DataService {
   }
 
   public set exhaustion(newValue: number) {
-    console.log('exhaustion: ', newValue);
     this._exhaustion = newValue;
+    this.writeCombatStatsToDatabase();
   }
 
-  private _conditions: string[] = ['Blind', 'Kampfunfähig'];
+  private _conditions: string[] = [];
 
   public get conditions(): string[] {
     return this._conditions;
   }
 
   public set conditions(newValue: string[]) {
-    console.log('conditions: ', newValue);
     this._conditions = newValue;
+    this.writeCombatStatsToDatabase();
+  }
+
+  private writeCombatStatsToDatabase() {
+    const combatStatsData = {
+      armorClass: this._armorClass,
+      initiative: this._initiative,
+      movement: this._movement,
+      deathSaves: this._deathSaves,
+      proficiencyBonus: this.proficiencySubject.getValue(),
+      inspiration: this._inspiration,
+      experience: this._experience,
+      exhaustion: this._exhaustion,
+      conditions: this._conditions,
+    };
+    this.setData('combatStats', combatStatsData);
+  }
+
+  // #endregion
+
+  // #region # HIT POINTS
+
+  private _hitPoints = {
+    maxHitPoints: 6,
+    currentHitPoints: 6,
+    temporaryHitPoints: 1,
+  };
+
+  public get hitPoints(): any {
+    return this._hitPoints;
+  }
+
+  public set hitPoints(newValue: any) {
+    this._hitPoints = newValue;
+    this.updateHitPoints();
+  }
+
+  private _hitDice = {
+    diceNumber: '1',
+    diceType: 'd10',
+  };
+
+  public get hitDice(): any {
+    return this._hitDice;
+  }
+
+  public set hitDice(newValue: any) {
+    this._hitDice = newValue;
+    this.updateHitPoints();
+  }
+
+  private updateHitPoints() {
+    const hitPointsData = {
+      hitPoints: this._hitPoints,
+      hitDice: this._hitDice,
+    };
+    this.setData('hitPoints', hitPointsData);
   }
 
   // #endregion
 
-  /**
-   *
-   * @param newValue The new value of the Attribute
-   */
+  // #region # ATTRIBUTES
   updateAttribute(newValue: Attribute) {
     const functionCall: string = newValue.name + 'Subject.next(newValue)';
     eval(`this.${functionCall}`);
-    console.log('updateAttribute: ', newValue.name);
-    // TODO: Datenbank updaten
+    const attributesData = {
+      strength: this.strengthSubject.getValue(),
+      dexterity: this.dexteritySubject.getValue(),
+      constitution: this.constitutionSubject.getValue(),
+      intelligence: this.intelligenceSubject.getValue(),
+      wisdom: this.wisdomSubject.getValue(),
+      charisma: this.charismaSubject.getValue(),
+    };
+    // TODO: ACTIVATE AGAIN
+    this.setData('attributes', attributesData);
   }
 
   private strengthSubject = new BehaviorSubject<Attribute>(
-    { name: 'strength', value: 19, proficiency: true } //erstmal nur gemockt, später muss der Wert aus der Datenbank kommen
+    { name: 'strength', value: 10, proficiency: true } //erstmal nur gemockt, später muss der Wert aus der Datenbank kommen
   );
   public strength$ = this.strengthSubject.asObservable();
 
   private dexteritySubject = new BehaviorSubject<Attribute>(
-    { name: 'dexterity', value: 17, proficiency: false } //erstmal nur gemockt, später muss der Wert aus der Datenbank kommen
+    { name: 'dexterity', value: 10, proficiency: false } //erstmal nur gemockt, später muss der Wert aus der Datenbank kommen
   );
   public dexterity$ = this.dexteritySubject.asObservable();
 
   private constitutionSubject = new BehaviorSubject<Attribute>(
-    { name: 'constitution', value: 12, proficiency: false } //erstmal nur gemockt, später muss der Wert aus der Datenbank kommen
+    { name: 'constitution', value: 10, proficiency: false } //erstmal nur gemockt, später muss der Wert aus der Datenbank kommen
   );
   public constitution$ = this.constitutionSubject.asObservable();
 
   private intelligenceSubject = new BehaviorSubject<Attribute>(
-    { name: 'intelligence', value: 13, proficiency: false } //erstmal nur gemockt, später muss der Wert aus der Datenbank kommen
+    { name: 'intelligence', value: 10, proficiency: false } //erstmal nur gemockt, später muss der Wert aus der Datenbank kommen
   );
   public intelligence$ = this.intelligenceSubject.asObservable();
 
   private wisdomSubject = new BehaviorSubject<Attribute>(
-    { name: 'wisdom', value: 13, proficiency: true } //erstmal nur gemockt, später muss der Wert aus der Datenbank kommen
+    { name: 'wisdom', value: 10, proficiency: true } //erstmal nur gemockt, später muss der Wert aus der Datenbank kommen
   );
   public wisdom$ = this.wisdomSubject.asObservable();
 
   private charismaSubject = new BehaviorSubject<Attribute>(
-    { name: 'charisma', value: 19, proficiency: false } //erstmal nur gemockt, später muss der Wert aus der Datenbank kommen
+    { name: 'charisma', value: 10, proficiency: false } //erstmal nur gemockt, später muss der Wert aus der Datenbank kommen
   );
   public charisma$ = this.charismaSubject.asObservable();
 
   // #endregion
 
-  // #region Skill observables
+  // #region # SKILLS
 
-  /**
-   *
-   * @param newValue The new value of the skill
-   */
   updateSkill(newValue: Skill) {
     const functionCall: string = newValue.name + 'Subject.next(newValue)';
     eval(`this.${functionCall}`);
-    console.log('updateSkill: ', newValue.name);
-    // TODO: Datenbank updaten
+    const skillsData = {
+      acrobatics: this.acrobaticsSubject.getValue(),
+      animalHandling: this.animalHandlingSubject.getValue(),
+      arcana: this.arcanaSubject.getValue(),
+      athletics: this.athleticsSubject.getValue(),
+      deception: this.deceptionSubject.getValue(),
+      history: this.historySubject.getValue(),
+      insight: this.insightSubject.getValue(),
+      intimidation: this.intimidationSubject.getValue(),
+      investigation: this.investigationSubject.getValue(),
+      medicine: this.medicineSubject.getValue(),
+      nature: this.natureSubject.getValue(),
+      perception: this.perceptionSubject.getValue(),
+      performance: this.performanceSubject.getValue(),
+      persuasion: this.persuasionSubject.getValue(),
+      religion: this.religionSubject.getValue(),
+      sleightOfHand: this.sleightOfHandSubject.getValue(),
+      stealth: this.stealthSubject.getValue(),
+      survival: this.survivalSubject.getValue(),
+    };
+    // TODO: ACTIVATE AGAIN
+    // this.setData('skills', skillsData);
   }
 
   private acrobaticsSubject = new BehaviorSubject<Skill>(
@@ -1039,87 +946,39 @@ export class DataService {
 
   // #endregion
 
-  // #region inventory
+  // #region # inventory
 
-  private _items: SimpleItem[] = [
-    {
-      name: 'Kurzbogen +1',
-      weight: 5,
-      value: 50,
-      quantity: 1,
-      description: 'Hallo',
-    },
-    {
-      name: 'Helebade',
-      weight: 10,
-      value: 5,
-      quantity: 1,
-      description: 'Hallo',
-    },
-    {
-      name: 'Armbrust',
-      weight: 8,
-      value: 6,
-      quantity: 1,
-      description: 'Hallo',
-    },
-  ];
+  private _favoriteWeapons: Weapon[] = [];
 
-  public get items(): SimpleItem[] {
-    return this._items;
+  public get favoriteWeapons(): Weapon[] {
+    return this._favoriteWeapons;
   }
 
-  public set items(newValue: SimpleItem[]) {
-    console.log('items: ', newValue);
-    this._items = newValue;
+  public set favoriteWeapons(weapons: Weapon[]) {
+    this._favoriteWeapons = weapons;
+    this.setData('favoriteWeapons', { data: this._favoriteWeapons });
   }
 
-  private _food: Food[] = [
-    {
-      name: 'Brot',
-      quantity: 7,
-      isReady: true,
-      weight: 0.5,
-    },
-    {
-      name: 'Suppe',
-      quantity: 4,
-      isReady: true,
-      weight: 0.5,
-    },
-    {
-      name: 'Fleisch',
-      quantity: 2,
-      isReady: false,
-      weight: 0.5,
-    },
-    {
-      name: 'Käse',
-      quantity: 1,
-      isReady: false,
-      weight: 0.5,
-    },
-    {
-      name: 'Bier',
-      quantity: 1,
-      isReady: false,
-      weight: 0.5,
-    },
-    {
-      name: 'Wein',
-      quantity: 1,
-      isReady: false,
-      weight: 0.5,
-    },
-  ];
+  private _weaponsAndArmor: SimpleItem[] = [];
+
+  public get weaponsAndArmor(): SimpleItem[] {
+    return this._weaponsAndArmor;
+  }
+
+  public set weaponsAndArmor(newValue: SimpleItem[]) {
+    this._weaponsAndArmor = newValue;
+    this.setData('weaponsAndArmor', { data: this._weaponsAndArmor });
+  }
+
+  private _food: Food[] = [];
 
   public get food(): Food[] {
     return this._food;
   }
 
   public set food(newValue: Food[]) {
-    // console.log('food: ', newValue);
     this._food = newValue;
+    this.setData('food', { data: this._food });
   }
 
   private _money: any = {
@@ -1135,60 +994,30 @@ export class DataService {
   }
 
   public set money(newValue: any) {
-    console.log('money: ', newValue);
     this._money = newValue;
+    this.setData('money', this._money);
   }
 
-  private _consumbales: SimpleItem[] = [
-    {
-      name: 'Heiltrank',
-      weight: 0.5,
-      value: 50,
-      quantity: 1,
-      description: 'Heilt 1W8 + 2 Trefferpunkte',
-    },
-    {
-      name: 'Öl',
-      weight: 1,
-      value: 1,
-      quantity: 1,
-      description: 'Brennt',
-    },
-  ];
+  private _consumbales: SimpleItem[] = [];
 
   public get consumables(): SimpleItem[] {
     return this._consumbales;
   }
 
   public set consumables(newValue: SimpleItem[]) {
-    console.log('consumables: ', newValue);
     this._consumbales = newValue;
+    this.setData('consumables', { data: this._consumbales });
   }
 
-  private _miscellaneous: SimpleItem[] = [
-    {
-      name: 'Rucksack',
-      weight: 5,
-      value: 2,
-      quantity: 1,
-      description: 'Hallo',
-    },
-    {
-      name: 'Seil',
-      weight: 5,
-      value: 2,
-      quantity: 1,
-      description: 'Hallo',
-    },
-  ];
+  private _miscellaneous: SimpleItem[] = [];
 
   public get miscellaneous(): SimpleItem[] {
     return this._miscellaneous;
   }
 
   public set miscellaneous(newValue: SimpleItem[]) {
-    console.log('misc: ', newValue);
     this._miscellaneous = newValue;
+    this.setData('miscellaneous', { data: this._miscellaneous });
   }
 
   // #endregion
@@ -1225,125 +1054,17 @@ export class DataService {
     return this.db.collection(collection).get({ keys: true });
   }
 
-  public deleteCollection(collection: string) {
-    this.db.collection(collection).delete();
+  public setData(key: string, data: any) {
+    return this.db
+      .collection(this.characterName)
+      .doc(key)
+      .set(data)
+      .then(() => {});
   }
 
-  // #endregion
-
-  // #region character selection and construction
-
-  /**
-   *
-   * @param character The name of the character that was selected
-   */
-  public async selectCharacter(character: string) {
-    console.log('selectCharacter ausgewählt');
-    const characterData = await this.getCollectionWithKeys(character);
-    this.character = this.buildCurrentCharacter(characterData);
-    console.log('character: ', this.character);
-    this.Router.navigate(['journal']);
+  public deleteCollection(collection: string) {
+    this.db.collection(collection).delete();
   }
 
-  private buildCurrentCharacter(currentCharacterData: any): Character {
-    const [
-      appearanceData,
-      attributesData,
-      characterData,
-      combatStatsData,
-      personalityData,
-      skillsData,
-      weaponsData,
-    ] = currentCharacterData.map((entry: any) => entry.data);
-
-    const appearance = {
-      age: appearanceData.age,
-      height: appearanceData.height,
-      weight: appearanceData.weight,
-      eyes: appearanceData.eyes,
-      skin: appearanceData.skin,
-      hair: appearanceData.hair,
-    };
-
-    const attributes = {
-      strength: attributesData.strength,
-      dexterity: attributesData.dexterity,
-      constitution: attributesData.constitution,
-      intelligence: attributesData.intelligence,
-      wisdom: attributesData.wisdom,
-      charisma: attributesData.charisma,
-    };
-
-    const character = {
-      name: characterData.name,
-      race: characterData.race,
-      class: characterData.class,
-      subclass: characterData.subclass,
-      level: characterData.level,
-      background: characterData.background,
-      experience: characterData.experience,
-      inspiration: characterData.inspiration,
-      proficiencyBonus: characterData.proficiencyBonus,
-    };
-
-    const combatStats = {
-      armorClass: combatStatsData.armorClass,
-      initiative: combatStatsData.initiative,
-      speed: combatStatsData.speed,
-      hitPointMaximum: combatStatsData.hitPointMaximum,
-      currentHitPoints: combatStatsData.currentHitPoints,
-      temporaryHitPoints: combatStatsData.temporaryHitPoints,
-      hitDice: combatStatsData.hitDice,
-      deathSaveSuccesses: combatStatsData.deathSaveSuccesses,
-      deathSaveFailures: combatStatsData.deathSaveFailures,
-    };
-
-    const personality = {
-      personalityTraits: personalityData.personalityTraits,
-      ideals: personalityData.ideals,
-      bonds: personalityData.bonds,
-      flaws: personalityData.flaws,
-    };
-
-    const skills = {
-      acrobatics: skillsData.acrobatics,
-      animalHandling: skillsData.animalHandling,
-      arcana: skillsData.arcana,
-      athletics: skillsData.athletics,
-      deception: skillsData.deception,
-      history: skillsData.history,
-      insight: skillsData.insight,
-      intimidation: skillsData.intimidation,
-      investigation: skillsData.investigation,
-      medicine: skillsData.medicine,
-      nature: skillsData.nature,
-      perception: skillsData.perception,
-      performance: skillsData.performance,
-      persuasion: skillsData.persuasion,
-      religion: skillsData.religion,
-      sleightOfHand: skillsData.sleightOfHand,
-      stealth: skillsData.stealth,
-      survival: skillsData.survival,
-    };
-    const weapons = {
-      name: weaponsData.name,
-      attackBonus: weaponsData.attackBonus,
-      damage: weaponsData.damage,
-      damageType: weaponsData.damageType,
-      range: weaponsData.range,
-      description: weaponsData.damageDice,
-    };
-    const newCharacter: Character = {
-      appearance: appearance,
-      attributes: attributes,
-      characterData: character,
-      combatStats: combatStats,
-      personality: personality,
-      skills: skills,
-      weapons: weapons,
-    };
-    console.log('newCharacter: ', newCharacter);
-    return newCharacter;
-  }
   // #endregion
 }

+ 16 - 0
src/services/dataResolve/data-resolver.service.spec.ts

@@ -0,0 +1,16 @@
+import { TestBed } from '@angular/core/testing';
+
+import { DataResolverService } from './data-resolver.service';
+
+describe('DataResolverService', () => {
+  let service: DataResolverService;
+
+  beforeEach(() => {
+    TestBed.configureTestingModule({});
+    service = TestBed.inject(DataResolverService);
+  });
+
+  it('should be created', () => {
+    expect(service).toBeTruthy();
+  });
+});

+ 14 - 0
src/services/dataResolve/data-resolver.service.ts

@@ -0,0 +1,14 @@
+import { Injectable } from '@angular/core';
+import { DataService } from '../data/data.service';
+import { Resolve } from '@angular/router';
+
+@Injectable({
+  providedIn: 'root',
+})
+export class DataResolverService implements Resolve<any> {
+  constructor(private dataAccessor: DataService) {}
+
+  resolve(): Promise<any> {
+    return this.dataAccessor.loadData();
+  }
+}