|
@@ -318,7 +318,10 @@ export class JournalSpellbookComponent {
|
|
const resultSubscription = this.modalAccessor.result$.subscribe(
|
|
const resultSubscription = this.modalAccessor.result$.subscribe(
|
|
(result) => {
|
|
(result) => {
|
|
if (result.state === 'delete') {
|
|
if (result.state === 'delete') {
|
|
- this.dataAccessor.deleteCustomSpellArray(result.data);
|
|
|
|
|
|
+ result.data.forEach((spell: Spell) => {
|
|
|
|
+ this.dataAccessor.deleteCustomSpell(spell);
|
|
|
|
+ this.deleteSpellFromPrepared(spell);
|
|
|
|
+ });
|
|
this.refreshFilteredSpells();
|
|
this.refreshFilteredSpells();
|
|
}
|
|
}
|
|
resultSubscription.unsubscribe();
|
|
resultSubscription.unsubscribe();
|
|
@@ -326,6 +329,42 @@ export class JournalSpellbookComponent {
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Searches for the level of the given spell and deletes it from the prepared spells.
|
|
|
|
+ * @param spell The spell that is to be deleted
|
|
|
|
+ */
|
|
|
|
+ public deleteSpellFromPrepared(spell: Spell): void {
|
|
|
|
+ if (spell.level === 0) {
|
|
|
|
+ this.dataAccessor.removeSpellFromLevel0(spell);
|
|
|
|
+ } else if (spell.level === 1) {
|
|
|
|
+ this.dataAccessor.removeSpellFromLevel1(spell);
|
|
|
|
+ }
|
|
|
|
+ if (spell.level === 2) {
|
|
|
|
+ this.dataAccessor.removeSpellFromLevel2(spell);
|
|
|
|
+ }
|
|
|
|
+ if (spell.level === 3) {
|
|
|
|
+ this.dataAccessor.removeSpellFromLevel3(spell);
|
|
|
|
+ }
|
|
|
|
+ if (spell.level === 4) {
|
|
|
|
+ this.dataAccessor.removeSpellFromLevel4(spell);
|
|
|
|
+ }
|
|
|
|
+ if (spell.level === 5) {
|
|
|
|
+ this.dataAccessor.removeSpellFromLevel5(spell);
|
|
|
|
+ }
|
|
|
|
+ if (spell.level === 6) {
|
|
|
|
+ this.dataAccessor.removeSpellFromLevel6(spell);
|
|
|
|
+ }
|
|
|
|
+ if (spell.level === 7) {
|
|
|
|
+ this.dataAccessor.removeSpellFromLevel7(spell);
|
|
|
|
+ }
|
|
|
|
+ if (spell.level === 8) {
|
|
|
|
+ this.dataAccessor.removeSpellFromLevel8(spell);
|
|
|
|
+ }
|
|
|
|
+ if (spell.level === 9) {
|
|
|
|
+ this.dataAccessor.removeSpellFromLevel9(spell);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
// SPELLCARDS
|
|
// SPELLCARDS
|
|
|
|
|
|
/**
|
|
/**
|