@@ -921,22 +921,14 @@ export function initConfig() {
921
921
922
922
const spellLevels = CONFIG . DND5E . spellLevels ;
923
923
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
-
930
924
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 ] ) ;
940
932
} )
941
933
942
934
for ( const [ item , spells ] of magicItems ) {
@@ -948,6 +940,7 @@ export function initConfig() {
948
940
} ,
949
941
} ) ;
950
942
}
943
+
951
944
this . items = this . items . filter ( ( item ) => ! itemsToIgnore . includes ( item ) ) ;
952
945
if ( this . showPreparedOnly ) {
953
946
const allowIfNotPrepared = [ "atwill" , "innate" , "pact" , "always" ] ;
0 commit comments