Skip to content

Commit cee4772

Browse files
committed
a
1 parent e2dccc6 commit cee4772

File tree

3 files changed

+10
-17
lines changed

3 files changed

+10
-17
lines changed

index.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/config.js

+8-15
Original file line numberDiff line numberDiff line change
@@ -921,22 +921,14 @@ export function initConfig() {
921921

922922
const spellLevels = CONFIG.DND5E.spellLevels;
923923
const itemsToIgnore = [];
924-
const magicItemsSpells = this.items.filter((item) => item.flags.dnd5e?.cachedFor);
925-
const activitySpellMap = magicItemsSpells.map(is => {
926-
const activity = fromUuidSync(this.actor.documentName + "." + this.actor.id + is.flags.dnd5e.cachedFor);
927-
return { spellItem: is, activity, magicItem: activity.item };
928-
})
929-
930924
const magicItems = new Map();
931-
activitySpellMap.forEach(spell => {
932-
itemsToIgnore.push(spell.spellItem);
933-
if(!spell.activity.displayInSpellbook) return;
934-
const current = magicItems.get(spell.magicItem);
935-
if (current) {
936-
current.push(spell.spellItem);
937-
} else {
938-
magicItems.set(spell.magicItem, [spell.spellItem]);
939-
}
925+
this.items.filter((item) => item.flags.dnd5e?.cachedFor).forEach(is => {
926+
const activity = fromUuidSync(this.actor.documentName + "." + this.actor.id + is.flags.dnd5e.cachedFor);
927+
itemsToIgnore.push(is);
928+
if(!activity.displayInSpellbook) return;
929+
const magicItem = activity.item;
930+
const current = magicItems.get(magicItem);
931+
current ? current.push(is) : magicItems.set(magicItem, [is]);
940932
})
941933

942934
for (const [item, spells] of magicItems) {
@@ -948,6 +940,7 @@ export function initConfig() {
948940
},
949941
});
950942
}
943+
951944
this.items = this.items.filter((item) => !itemsToIgnore.includes(item));
952945
if (this.showPreparedOnly) {
953946
const allowIfNotPrepared = ["atwill", "innate", "pact", "always"];

0 commit comments

Comments
 (0)