11import CONSTANTS from '../constants.js' ;
22import { processNotes } from "../textUtil.js" ;
3+ import { processRawNotes } from "../textUtil.js" ;
34
45export async function bladesInTheDark ( actor , displayImages ) {
56 // Using a guard here looks cleaner
@@ -19,7 +20,11 @@ export async function bladesInTheDark(actor, displayImages) {
1920 return null ;
2021 }
2122 case "factions" :
22- return null ;
23+ if ( game . settings . get ( CONSTANTS . MODULE_ID , 'displayNPC' ) ) {
24+ return await getFactionNotes ( displayImages , actor , actorIsOwner ) ;
25+ } else {
26+ return null ;
27+ }
2328 case "character" :
2429 if ( game . settings . get ( CONSTANTS . MODULE_ID , 'displayPC' ) ) {
2530 return await getCharacterNotes ( displayImages , actor , actorIsOwner ) ;
@@ -38,13 +43,26 @@ export async function bladesInTheDark(actor, displayImages) {
3843}
3944
4045async function getClockNotes ( displayImages , actor , actorIsOwner ) {
41- return await processNotes ( actor . system ?. value + " / " + actor . system ?. type , actorIsOwner , displayImages ) ;
46+ return await processRawNotes ( actor . system ?. value + " / " + actor . system ?. type , actorIsOwner , displayImages ) ;
4247}
4348
4449async function getCharacterNotes ( displayImages , actor , actorIsOwner ) {
45- return await processNotes ( actor . system ?. description , actorIsOwner , displayImages ) ;
50+ return await processRawNotes ( actor . system ?. description , actorIsOwner , displayImages ) ;
4651}
4752
4853async function getNPCNotes ( displayImages , actor , actorIsOwner ) {
49- return await processNotes ( actor . system ?. notes , actorIsOwner , displayImages ) ;
54+ return await processRawNotes ( actor . system ?. notes , actorIsOwner , displayImages ) ;
55+ }
56+
57+ async function getFactionNotes ( displayImages , actor , actorIsOwner ) {
58+ let factionNote = "" ;
59+ for ( let i = 0 ; i < actor . items . contents . length ; i += 1 ) {
60+ factionNote = factionNote . concat ( "<div class=\"token-note-hover-hud-h3\">" ) ;
61+ factionNote = factionNote . concat ( actor . items . contents [ i ] . name ) ;
62+ factionNote = factionNote . concat ( "</div>" ) ;
63+ factionNote = factionNote . concat ( "<p>" ) ;
64+ factionNote = factionNote . concat ( actor . items . contents [ i ] . system . description ) ;
65+ factionNote = factionNote . concat ( "</p>" ) ;
66+ }
67+ return await processNotes ( factionNote , actorIsOwner , displayImages ) ;
5068}
0 commit comments