@@ -11,30 +11,37 @@ export function formatIChingKnowledge(character: Character): string {
11
11
return "" ;
12
12
}
13
13
14
- const trigramsSection = character . systemKnowledge . iChing . trigrams ?. map ( trigram => `
15
- ${ trigram . trigramFigure } ${ trigram . name } (${ trigram . key } )
16
- Quality: ${ trigram . quality }
17
- Traits: ${ trigram . traits }
18
- Personages: ${ trigram . personages }
19
- Animal: ${ trigram . totemicAnimal }
20
- Immortal: ${ trigram . immortal }
21
- Nature: ${ trigram . imageInNature }
22
- ` . trim ( ) ) . join ( '\n\n' ) ;
23
-
24
- const hexagramsSection = character . systemKnowledge . iChing . hexagrams . map ( hexagram => `
25
- Hexagram ${ hexagram . number } ${ hexagram . unicode } - ${ hexagram . name . chinese } (${ hexagram . name . pinyin } )
26
- Trigrams: ${ hexagram . trigrams . top } over ${ hexagram . trigrams . bottom }
27
- Meaning: ${ hexagram . meaning }
28
- ` . trim ( ) ) . join ( '\n\n' ) ;
14
+ const formattedData = {
15
+ trigrams : character . systemKnowledge . iChing . trigrams ?. map ( ( trigram ) => ( {
16
+ symbol : trigram . trigramFigure ,
17
+ name : trigram . name ,
18
+ key : trigram . key ,
19
+ quality : trigram . quality ,
20
+ traits : trigram . traits ,
21
+ personages : trigram . personages ,
22
+ animal : trigram . totemicAnimal ,
23
+ immortal : trigram . immortal ,
24
+ nature : trigram . imageInNature ,
25
+ } ) ) ,
26
+ hexagrams : character . systemKnowledge . iChing . hexagrams . map (
27
+ ( hexagram ) => ( {
28
+ number : hexagram . number ,
29
+ symbol : hexagram . unicode ,
30
+ name : {
31
+ chinese : hexagram . name . chinese ,
32
+ pinyin : hexagram . name . pinyin ,
33
+ } ,
34
+ trigrams : {
35
+ top : hexagram . trigrams . top ,
36
+ bottom : hexagram . trigrams . bottom ,
37
+ } ,
38
+ meaning : hexagram . meaning ,
39
+ } )
40
+ ) ,
41
+ } ;
29
42
30
43
return addHeader (
31
44
"# I Ching Knowledge" ,
32
- `
33
- # Trigrams
34
- ${ trigramsSection }
35
-
36
- # Hexagrams
37
- ${ hexagramsSection }
38
- ` . trim ( )
45
+ JSON . stringify ( formattedData , null , 2 )
39
46
) ;
40
- }
47
+ }
0 commit comments