@@ -19,23 +19,27 @@ function add(recipe_id: string, level: number) {
1919 );
2020}
2121for (const recipe of data .byType (" recipe" )) {
22- if (recipe .result && Array .isArray (recipe .book_learn ))
22+ if (! recipe .result ) continue ;
23+ if (Array .isArray (recipe .book_learn )) {
2324 for (const [id, level = 0 ] of recipe .book_learn )
2425 if (id === item .id ) add (recipe .result , level );
25- else if (recipe .book_learn )
26- for (const [id, obj] of Object .entries (
27- recipe .book_learn as Record <string , any >
28- ))
29- if (id === item .id ) add (recipe .result , obj .skill_level ?? 0 );
26+ } else if (recipe .book_learn ) {
27+ for (const [id, obj] of Object .entries (
28+ recipe .book_learn as Record <string , any >
29+ ))
30+ if (id === item .id ) add (recipe .result , obj .skill_level ?? 0 );
31+ }
3032}
33+
34+ const readSkill = item .read_skill ?? item .skill ;
3135 </script >
3236
3337<section >
3438 <h1 >{t (" Book" , { _context , _comment: " Section heading" })}</h1 >
3539 <dl >
36- {#if item . skill }
40+ {#if readSkill }
3741 <dt >{t (" Skill" , { _context })}</dt >
38- <dd ><ThingLink id ={item . skill } type =" skill" /></dd >
42+ <dd ><ThingLink id ={readSkill } type =" skill" /></dd >
3943 <dt >{t (" Required Level" , { _context })}</dt >
4044 <dd >{item .required_level ?? 0 }</dd >
4145 <dt >{t (" Maximum Level" , { _context })}</dt >
0 commit comments